public NetworkClient(string serverAddr, int serverPort) { this.serverAddr = serverAddr; this.serverPort = serverPort; tcpClient = null; data = null; canReceiveNewData = true; SetState(NetworkClientState.None); }
private void ConnectToServerCallback(IAsyncResult ar) { try { tcpClient.EndConnect(ar); data = new NetworkData(); Debug.Log("NetworkClient - Connected!"); SetState(NetworkClientState.Connected); Receive(); } catch (Exception e) { Debug.LogWarning("NetworkClient - " + e.Message); SetState(NetworkClientState.Error); } }