/// <summary> /// Detaches the event handler from the object it's currently attached to. /// </summary> public void Detach() { _server.Connected -= Connected; _server.Disconnected -= Disconnected; _server.Received -= Received; _server = null; }
/// <summary> /// Constructor for an event handler. /// </summary> /// <param name="server">Server that needs to be listened to.</param> protected ServerEventListener(TcpEventServer server) { _server = server; _server.Connected += Connected; _server.Disconnected += Disconnected; _server.Received += Received; }
public CommServer(int lobbyport) { string a = Dns.GetHostName(); IPHostEntry ipEntry = Dns.GetHostEntry(a); IPAddress[] ips = ipEntry.AddressList; string ip = ips[0].ToString(); tcpServer = new TcpEventServer(ip, lobbyport); tcpServer.ClientAccepted += new Helper.Handlers.IntEH(listener_ClientAccepted); tcpServer.PacketReceived += new Handlers.IntPacketEH(PacketReceived); }
public CommServer(int lobbyport) { string a = Dns.GetHostName(); IPHostEntry ipEntry = Dns.GetHostEntry(a); IPAddress[] ips = ipEntry.AddressList; string ip = ips[0].ToString(); listener = new TcpEventServer(ip, lobbyport); listener.ClientAccepted += new TcpEventServer.ClientAcceptedEventHandler(listener_ClientAccepted); tmrUpdateClients = new System.Timers.Timer(); tmrUpdateClients.Interval = 200; tmrUpdateClients.Elapsed += new System.Timers.ElapsedEventHandler(tProcessClientsTimer_Elapsed); }