Exemplo n.º 1
0
 public bool IsOnline()
 {
     try
     {
         var testData = NetworkData.GetNetworkBytes(new NetworkData(DataType.Heartbeat, null));
         networkStream.Write(testData, 0, testData.Length);
         return(true);
     }
     catch (Exception)
     {
         Disconnect();
         return(false);
     }
 }
Exemplo n.º 2
0
 public void Send(byte [] data)
 {
     if (!Connected)
     {
         return;
     }
     try
     {
         var networkdata = new NetworkData(DataType.Normal, data);
         var sendingdata = NetworkData.GetNetworkBytes(networkdata);
         networkStream.Write(sendingdata, 0, sendingdata.Length);
     }
     catch
     {
         Disconnect();
     }
 }