Exemplo n.º 1
0
 /// <summary>
 /// Static async send
 /// </summary>
 /// <param name="bytes"></param>
 /// <param name="remoteIpAddress"></param>
 /// <param name="remotePort"></param>
 /// <param name="localPort"></param>
 /// <returns></returns>
 public static async Task <bool> SendOnceAsync(byte[] bytes, IPAddress remoteIpAddress, int remotePort, int localPort = 0)
 {
     return(await Task.Run(() =>
     {
         try
         {
             Udp.SendOnce(bytes, new IPEndPoint(remoteIpAddress, remotePort), localPort);
         }
         catch (Exception)
         {
             return false;
         }
         return true;
     }).ConfigureAwait(false));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Static send
 /// </summary>
 /// <param name="bytes"></param>
 /// <param name="remoteIpAddress"></param>
 /// <param name="remotePort"></param>
 /// <param name="localPort"></param>
 public static void SendOnce(byte[] bytes, IPAddress remoteIpAddress, int remotePort, int localPort = 0)
 {
     Udp.SendOnce(bytes, new IPEndPoint(remoteIpAddress, remotePort), localPort);
 }