Exemplo n.º 1
0
        /// <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;
        }
Exemplo n.º 2
0
        /// <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;
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }