Beispiel #1
0
        public void Connect()
        {
            if (!ConnectionAlive)
            {
                try
                {
                    SocketClient = new TcpClient(HostName, Port);
                    ServListener = new ServeurListener(SocketClient);
                    ServListener.ServeurConnectionEnded += new ServeurListener.ServeurConnectionEndedEventHandler(ServListener_ServeurConnectionEnded);
                    ServListener.ServeurMessageReceived += new ServeurListener.ServeurMessageReceivedEventHandler(ServListener_ServeurMessageReceived);
                    ServListener.StartListening();
                    ConnectionAlive = true;
                }
                catch (Exception)
                {

                }
            }
        }
Beispiel #2
0
 void ServListener_ServeurMessageReceived(ServeurListener sender, NetMessage msg)
 {
     OnServeurMessageReceived(msg);
 }
Beispiel #3
0
 void ServListener_ServeurConnectionEnded(ServeurListener sender)
 {
     ConnectionAlive = false;
     OnConnectionEnded();
 }