/// <summary>
 /// Send segment to local daemon
 /// </summary>
 /// <param name="segment">The segment to be sent</param>
 public void Send(Entity segment)
 {
     try
     {
         var packet = _marshaller.Marshall(segment);
         var data   = Encoding.ASCII.GetBytes(packet);
         _udpClient.Send(data, data.Length, EndPoint);
     }
     catch (SocketException e)
     {
         _logger.Error(e, "Failed to send package through socket.");
     }
     catch (ArgumentNullException e)
     {
         _logger.Error(e, "The udp data gram is null.");
     }
     catch (ObjectDisposedException e)
     {
         _logger.Error(e, "The udp client is already closed.");
     }
     catch (InvalidOperationException e)
     {
         _logger.Error(e, "The udp client connection is invalid.");
     }
 }
Beispiel #2
0
 /// <summary>
 /// Send segment to local daemon
 /// </summary>
 /// <param name="segment">The segment to be sent</param>
 public void Send(Entity segment)
 {
     try
     {
         var packet = _marshaller.Marshall(segment);
         var data   = Encoding.ASCII.GetBytes(packet);
         var ip     = EndPoint; //Need local var to ensure ip do not updates
         _logger.DebugFormat("UDP Segment emitter endpoint: {0}.", ip);
         _udpClient.Send(data, data.Length, ip);
     }
     catch (SocketException e)
     {
         _logger.Error(e, "Failed to send package through socket.");
     }
     catch (ArgumentNullException e)
     {
         _logger.Error(e, "The udp data gram is null.");
     }
     catch (ObjectDisposedException e)
     {
         _logger.Error(e, "The udp client is already closed.");
     }
     catch (InvalidOperationException e)
     {
         _logger.Error(e, "The udp client connection is invalid.");
     }
 }