Esempio n. 1
0
 void ConnectionLost(int iD)
 {
     if (m_serverSocket != null)
     {
         m_serverSocket.StopClient();
         m_serverSocket = null;
         m_connected    = false;
         ConnectionLostEvent();
     }
 }
Esempio n. 2
0
 void TryConnect()
 {
     while (!m_connected)
     {
         try
         {
             TcpClient tempClientTcp = new TcpClient();
             tempClientTcp.Connect(m_ipAdress, 34000);
             m_serverSocket = new TcpSocket(tempClientTcp, 0);
             m_serverSocket.NewMessageEvent       += new NewMessageHandler(NewMessage);
             m_serverSocket.DisconnectClientEvent += new DisconnectClientHandler(ConnectionLost);
             m_serverSocket.StartClient();
             m_connected = true;
             SendFileInfo();
             SendPlayerData(m_hero.player);
         }
         catch
         {
             Thread.Sleep(1000);
         }
     }
 }
Esempio n. 3
0
 public Client(TcpSocket socket, int clientID)
 {
     tileMapIdendifiers = new List <TileMapIdentifier>();
     iD        = clientID;
     tcpSocket = socket;
 }