static void SendTCP(IP2PBase Item, TcpClient Client) { if (Client != null && Client.Connected) { byte[] Data = Item.ToByteArray(); NetworkStream NetStream = Client.GetStream(); NetStream.Write(Data, 0, Data.Length); } }
public void SendMessageTCP(IP2PBase Item) { if (TCPClient.Connected) { byte[] Data = Item.ToByteArray(); try { NetworkStream NetStream = TCPClient.GetStream(); NetStream.Write(Data, 0, Data.Length); } catch (Exception e) { if (OnResultsUpdate != null) { OnResultsUpdate.Invoke(this, "Error on TCP Send: " + e.Message); } } } }
public void SendMessageUDP(IP2PBase Item, IPEndPoint EP) { Item.ID = LocalClientInfo.ID; byte[] data = Item.ToByteArray(); try { if (data != null) { UDPClient.Send(data, data.Length, EP); } } catch (Exception e) { if (OnResultsUpdate != null) { OnResultsUpdate.Invoke(this, "Error on UDP Send: " + e.Message); } } }
static void SendUDP(IP2PBase Item, IPEndPoint EP) { byte[] Bytes = Item.ToByteArray(); UDP.Send(Bytes, Bytes.Length, UDPEndPoint); }
public void SendMessageUDP(IP2PBase Item, IPEndPoint EP) { Item.ID = LocalClientInfo.ID; byte[] data = Item.ToByteArray(); try { if (data != null) UDPClient.Send(data, data.Length, EP); } catch (Exception e) { if (OnResultsUpdate != null) OnResultsUpdate.Invoke(this, "Error on UDP Send: " + e.Message); } }
public void SendMessageTCP(IP2PBase Item) { if (TCPClient.Connected) { byte[] Data = Item.ToByteArray(); try { NetworkStream NetStream = TCPClient.GetStream(); NetStream.Write(Data, 0, Data.Length); } catch (Exception e) { if (OnResultsUpdate != null) OnResultsUpdate.Invoke(this, "Error on TCP Send: " + e.Message); } } }