public void SendMessageUDP(NetData message) { message.SetNumber(numberUDP); byte[] data = NetData.GetBytesData(message); udpClient.Send(data, data.Length); numberUDP++; }
public void SendMessageTCP(NetData message) { message.SetNumber(numberTCP); byte[] data = NetData.GetBytesData(message); stream.Write(data, 0, data.Length); stream.Flush(); numberTCP++; }
internal static void InvokeTypeActionTCP(ushort type, byte[] message, NetData data, User sender) { if (typesActions.ContainsKey(type)) { if (data.broadcast) { sender.currentRoom.BroadcastMessageTCP(NetData.GetBytesData(data), sender); } typesActions[type].Invoke(data.data, data.senderID); } }
private void ConnectContinue() { udpClient.Connect(remoteAddressUDP); Thread.Sleep(100); stream = tcpClient.GetStream(); NetData message = new NetData(0, user); message.SetNumber(numberTCP); byte[] data = NetData.GetBytesData(message); numberTCP++; numberUDP++; stream.Write(data, 0, data.Length); Thread.Sleep(100); udpClient.Send(data, data.Length); onConnect?.Invoke(); ReceiveMessageTCP(); ReceiveMessageUDP(); }
public override void SendMessage(NetData message) { byte[] data = NetData.GetBytesData(message); ServerHandler.udpListener.Send(data, data.Length, adress); }
public void SendMessageUDP(NetData message) { byte[] data = NetData.GetBytesData(message); udpClient.Send(data, data.Length); }
public void SendMessageTCP(NetData message) { byte[] data = NetData.GetBytesData(message); stream.Write(data, 0, data.Length); }
public override void SendMessage(NetData message) { byte[] data = NetData.GetBytesData(message); udpClient.BeginSend(data, data.Length, adress, EndSendCallback, udpClient); }
public override void SendMessage(NetData message) { byte[] data = NetData.GetBytesData(message); SendMessage(data); }