Beispiel #1
0
 public void Send(GelfMessage message)
 {
     using (var udpClient = new UdpClient())
         foreach (var bytes in encoder.Encode(messageSerializer.Serialize(message)))
         {
             udpClient.Send(bytes, bytes.Length, configuration.GetHost());
         }
 }
Beispiel #2
0
        private void EstablishConnection()
        {
            if (udpClient != null)
            {
                return;
            }
            var host = configuration.GetHost();

            try
            {
                udpClient = new UdpClient();
                udpClient.Connect(host);
            }
            catch (Exception exception)
            {
                Close();
                throw new CannotConnectException(string.Format("Cannot connect to {0}", host), exception);
            }
        }