只有部分功能
// 获取本地IP地址
private string myIp;
private void GetIP()
{foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()){if (ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 || ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet){foreach (UnicastIPAddressInformation ip in ni.GetIPProperties().UnicastAddresses){if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork){myIP = ip.Address.ToString();}}}}
}
// 携带数据向服务器发送消息
// url就是网址
public void Send(HttpResponseData data)
{var http = new HTTPRequest(new Uri(url), (req, response) =>{if (response == null){Log.Error("出错了!!!!!!!!!!!!!!!!!!!!!!!!");}else{}});data.itemId = "01";data.operatorName = myIP;StringBuilder stringBuilder = new StringBuilder();stringBuilder.Append(data.itemId + "-");stringBuilder.Append(data.operatorName + "-");stringBuilder.Append(data.startTime + "-");stringBuilder.Append(data.endTime + "-");var bytes = System.Text.Encoding.UTF8.GetBytes(stringBuilder.ToString());http.AddBinaryData("json", bytes);http.Send();
}public class HttpResponseData{public string startTime;public string endTime;public string itemId;public string operatorName;}