--
发送:
GelfLogModel m = new GelfLogModel(); m.version = "1.1"; m.host = "128.0.14.39"; m.short_message = "异常"; //三个必须 m.full_message = "full_message ,测试1"; m.timestamp = MU.GetTimeStampTen(); string json = JsonConvert.SerializeObject(m); IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("128.0.255.10"), 12201); Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); byte[] data = Encoding.UTF8.GetBytes(json); server.SendTo(data, data.Length, SocketFlags.None, ipep);//将数据发送到指定的终结点 MessageBox.Show("finish");
---
timestamp:
public static long GetTimeStampTen() { return (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000; }
---