Esempio n. 1
0
 /// <summary>
 /// Static method for sending out kaillera message - DO NOT USE if connection is already established - it will not work
 /// because multiple UDP clients cannot bind
 /// </summary>
 /// <param name="ki"></param>
 /// <param name="address"></param>
 /// <param name="localAddress"></param>
 public static void SendMessage(KailleraInstruction ki, IPEndPoint address, IPEndPoint localAddress)
 {
     lock (mutex)
     {
         byte[] buffer = new byte[ki.length + 4];
         buffer[0] = 1;
         byte[] instructArray = ki.toBytes();
         instructArray.CopyTo(buffer, 1);
         UdpClient client = new UdpClient(localAddress);
         client.Send(buffer, buffer.Length, address);
         client.Close();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Static method for sending out kaillera message - DO NOT USE if connection is already established - it will not work
 /// because multiple UDP clients cannot bind
 /// </summary>
 /// <param name="ki"></param>
 /// <param name="address"></param>
 /// <param name="localAddress"></param>
 public static void SendMessage(KailleraInstruction ki, IPEndPoint address, IPEndPoint localAddress)
 {
     lock (mutex)
     {
         byte[] buffer = new byte[ki.length + 4];
         buffer[0] = 1;
         byte[] instructArray = ki.toBytes();
         instructArray.CopyTo(buffer, 1);
         UdpClient client = new UdpClient(localAddress);
         client.Send(buffer, buffer.Length, address);
         client.Close();
     }
 }