void OnServerConnect(IAsyncResult asyncResult) { TcpClient tcpClient = tcpListener.EndAcceptTcpClient(asyncResult); TcpConnectedClient connectedClient = new TcpConnectedClient(tcpClient, this); clients.Add(connectedClient); tcpListener.BeginAcceptTcpClient(OnServerConnect, null); }
public void Connect() { instance = this; var TcpClient = new TcpClient(); connectedClient = new TcpConnectedClient(TcpClient); TcpClient.BeginConnect("192.168.0.107", 6323, (ar) => connectedClient.EndConnect(ar), null); //13.53.190.82 // }
public override void StartClient(IPAddress serverIP, int port) { IsServer = false; this.serverIP = serverIP; TcpClient tcpClient = new TcpClient(); client = new TcpConnectedClient(tcpClient, this); tcpClient.BeginConnect(serverIP, port, OnClientConnect, null); }
// Use this for initialization void Awake() { serverIP = Data.ip; instance = this; TcpClient tcpClient = new TcpClient(); TcpConnectedClient connectedClient = new TcpConnectedClient(tcpClient); tcpClient.BeginConnect(serverIP, Data.port, ar => connectedClient.EndConnect(ar), null); LoginController.generatePlayer(Data.login); }
public void OnClientDisconnect(TcpConnectedClient client) { clients.Remove(client); }
internal void OnDisconnect(TcpConnectedClient client) { clientList.Remove(client); }