Exemplo n.º 1
0
 public void Connect()
 {
     var ipAddress = SettingVM.Instance.ServerAddress;
     if (_tcpClient.Connect(ipAddress, Common.Port))
     {
         IsConnected = true;
         var client = new ClientModel();
         client.HostName = SettingVM.Instance.HostName;
         client.IPAddress = Common.GetLocalIPAddress();
         var xml = SerializerHelper.SerializerObject<ClientModel>(client);
         var buffer = Encoding.UTF8.GetBytes(xml);
         var flag = Constants.CONNECT_FLAG;
         _tcpClient.Send(flag, buffer);
     }
     else
     {
         IsConnected = false;
     }
 }
Exemplo n.º 2
0
        private void ServerOpened()
        {
            IsConnected = true;

            var client = new ClientModel();
            client.HostName = SettingVM.Instance.HostName;
            client.IPAddress = Common.GetLocalIPAddress();
            var xml = SerializerHelper.SerializerObject<ClientModel>(client);
            var buffer = Encoding.UTF8.GetBytes(xml);
            var flag = Constants.CONNECT_FLAG;
            _tcpClient.Send(flag, buffer);
        }