コード例 #1
0
 public NetworkClient(string serverAddr, int serverPort)
 {
     this.serverAddr   = serverAddr;
     this.serverPort   = serverPort;
     tcpClient         = null;
     data              = null;
     canReceiveNewData = true;
     SetState(NetworkClientState.None);
 }
コード例 #2
0
        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);
            }
        }