public UCClientConnection(object reactingObject, string rootPath, IFormatter customFormatter = null, ILogger logger = null, bool useCompression = false) : base(customFormatter, logger, useCompression) { if (reactingObject != null) { Reactor = new Reactor(this, reactingObject); } if (rootPath != null) { FileManager = new FileExchangeManager(rootPath, this); } MessageReceived += ObjectTunnelClientConnection_MessageReceived; this.Started += (_, __) => Reactor.Start(); }
public UCServerConnection(TcpClient client, object reactingObject, string rootPath, IFormatter formatter = null, ILogger logger = null, bool useCompression = false) : base(formatter, logger, useCompression) { if (reactingObject != null) { Reactor = new Reactor(this, reactingObject); } MessageReceived += ObjectTunnelClientConnection_MessageReceived; Started += (_, __) => { Reactor?.Start(); if (rootPath != null) { FileManager = new FileExchangeManager(rootPath, this); } }; var ok = Start(client); if (!ok) { throw new Exception("Server connection failed."); } }