void ConnectionLost(int iD) { if (m_serverSocket != null) { m_serverSocket.StopClient(); m_serverSocket = null; m_connected = false; ConnectionLostEvent(); } }
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); } } }
public Client(TcpSocket socket, int clientID) { tileMapIdendifiers = new List <TileMapIdentifier>(); iD = clientID; tcpSocket = socket; }