Esempio n. 1
0
 public void SendMessageUDP(NetData message)
 {
     message.SetNumber(numberUDP);
     byte[] data = NetData.GetBytesData(message);
     udpClient.Send(data, data.Length);
     numberUDP++;
 }
Esempio n. 2
0
 public void SendMessageTCP(NetData message)
 {
     message.SetNumber(numberTCP);
     byte[] data = NetData.GetBytesData(message);
     stream.Write(data, 0, data.Length);
     stream.Flush();
     numberTCP++;
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
 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);
 }
Esempio n. 8
0
 public override void SendMessage(NetData message)
 {
     byte[] data = NetData.GetBytesData(message);
     udpClient.BeginSend(data, data.Length, adress, EndSendCallback, udpClient);
 }
Esempio n. 9
0
 public override void SendMessage(NetData message)
 {
     byte[] data = NetData.GetBytesData(message);
     SendMessage(data);
 }