Socket通信
作者:互联网
Socket命令发送
public void LostLicense(LicenseInfo license) { var arr = Dao.QueryForList<Hashtable>(Dao.GetStatementName("LostLicense"), license); string socketIpPort = ConfigurationManager.AppSettings["socketIpPort"]; if (arr != null && socketIpPort != null) { string[] strIp = socketIpPort.Split(':'); IPAddress ip = IPAddress.Parse(strIp[0]); int port = int.Parse(strIp[1]); foreach (var i in arr) { Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); clientSocket.Connect(new IPEndPoint(ip, port)); var s = Convert.ToString(int.Parse(i["MNGINSID"].ToString()), 16).PadLeft(10, '0'); clientSocket.Send(HexStrTobyte("3C09" + s + "39FF")); clientSocket.Close(); } } }View Code
标签:arr,socketIpPort,int,通信,var,clientSocket,Socket 来源: https://www.cnblogs.com/yyzyou/p/12975000.html