public ConnectionServer() { Client = new JBVClient(SoftwareID.ConnectionServer); router = new Router(); leaseHandler = new LeaseHandler(); logHandler = new LogHandler(); DummyConnection cRouter1 = new DummyConnection(); DummyConnection cRouter2 = new DummyConnection(); DummyConnection cRouter3 = new DummyConnection(); router.AddConnection(cRouter1); router.AddConnection(cRouter2); router.AddConnection(cRouter3); DummyConnection.CoupleConnections(cRouter1, Client.Connection); DummyConnection.CoupleConnections(cRouter2, leaseHandler.Connection); DummyConnection.CoupleConnections(cRouter3, logHandler.Connection); listener = new TcpSocketListener(); listener.OnClientAccept += (sender, client) => router.AddConnection(new TCPConnection(client)); listener.BeginListening(Settings.Items.ListenerPort); }
public TileMapClient() { connection = new TCPConnection(socket); client = new JBVClient(SoftwareID.TileMapClient); client.SetConnection(connection); client.OnMessageRecieved += Client_OnMessageRecieved; client.OnSoftwareIDRecieved += Client_OnSoftwareIDRecieved; work = new Task(Work); work.Start(); workTick = new System.Timers.Timer(); workTick.Interval = 1000; workTick.Elapsed += (a, b) => notify.SetBits((UInt32)Events.TimerElapsed); workTick.Start(); socket.OnDisconnected += (a, b) => notify.SetBits((UInt32)Events.Disconnected); }