Пример #1
0
        public override async Task Send(InfluxPoint point)
        {
            try
            {
                using (var client = new UdpClient())
                {
                    var line   = point.ToLineProtocol();
                    var data   = Encoding.UTF8.GetBytes(line);
                    var length = await client.SendAsync(data, data.Length, _hostname, _port);

                    Log.Debug(line + " - " + length);
                }
            }
            catch (Exception ex)
            {
                Log.Debug(ex.ToString());
            }
        }
Пример #2
0
 public override async Task Send(InfluxPoint point)
 {
     try
     {
         var request = (HttpWebRequest)WebRequest.Create(_url);
         request.ContentType = "text/plain";
         request.Method      = "POST";
         using (var stream = await request.GetRequestStreamAsync())
         {
             var line = point.ToLineProtocol();
             Log.Debug(line);
             stream.Write(Encoding.UTF8.GetBytes(line), 0, line.Length);
             using (var response = (HttpWebResponse)await request.GetResponseAsync())
                 Log.Debug(response.StatusCode.ToString());
         }
     }
     catch (Exception ex)
     {
         Log.Debug(ex.ToString());
     }
 }
Пример #3
0
 public abstract Task Send(InfluxPoint point);