/** * Class constructor */ public Client(TransportClient transport, IClientListener clientListener) { this.clientListener = clientListener; dispatcher = new ChannelDispatcher(); transport.SetChannelDispatcher(dispatcher); surfaceServer = new SurfaceServer(transport, this); dispatcher.RegisterChannel(surfaceServer); sessionServer = new SessionServer(transport, this); dispatcher.RegisterChannel(sessionServer); inputServer = new InputServer(transport, this); dispatcher.RegisterChannel(inputServer); transport.StartThread(); dispatcher.OnConnect(); }
/** * Class constructor */ public Client(TransportClient transport, IClientRequestListener listener) : base(transport) { this.thread = new Thread(ReceiverThreadProc); thread.Start(); this.listener = listener; this.transport = transport; dispatcher = new ChannelDispatcher(); transport.SetChannelDispatcher(dispatcher); surface = new Surface(this.transport); dispatcher.RegisterChannel(surface); session = new Session(this.transport, this); dispatcher.RegisterChannel(session); dispatcher.OnConnect(); transport.StartThread(); }
/** * Is invoked when application launches. Connects the Client to the Server */ public void OnUserConnect(string address, int port) { ChannelDispatcher dispatcher = new ChannelDispatcher(); this.transport = new TransportClient(dispatcher); sessionClient = new SessionClient(this.transport, this); dispatcher.RegisterChannel(sessionClient); surfaceClient = new SurfaceClient(this, this.transport); dispatcher.RegisterChannel(surfaceClient); inputClient = new InputClient(this.transport); dispatcher.RegisterChannel(inputClient); try { this.transport.Connect(address, port); DisplayStatusText("Welcome! You are connected to Screenary server at " + address + " : " + port); } catch (TransportException e) { ExceptionDialog exception = new ExceptionDialog("Operation Fail", "Could not connect to Screenary server at " + address + " : " + port + "\nVerify connections."); } }
public TransportClient(ChannelDispatcher dispatcher, TcpClient tcpClient) { this.dispatcher = dispatcher; this.tcpClient = tcpClient; }
public TransportClient(ChannelDispatcher dispatcher) { this.dispatcher = dispatcher; this.tcpClient = null; }
public TransportClient(TcpClient tcpClient) { this.dispatcher = null; this.tcpClient = tcpClient; }
public void SetChannelDispatcher(ChannelDispatcher dispatcher) { this.dispatcher = dispatcher; }
public void OnUserConnect(string address, int port) { ChannelDispatcher dispatcher = new ChannelDispatcher(); this.transport = new TransportClient(dispatcher); session = new Session(this.transport, this); dispatcher.RegisterChannel(session); SurfaceClient surface = new SurfaceClient(this, this.transport); dispatcher.RegisterChannel(surface); this.transport.Connect(address, port); Console.WriteLine("connected to screenary server at {0}:{1}", address, port); notificationBar.Push (id, "Welcome! You are connected to Screenary server at " + address + " : " + port); }