标签:
通信框架为networkcomms2.3.1
服务器端监听代码:
//从配置文件获取IP和端口 string strIP = System.Configuration.ConfigurationManager.AppSettings["IPAddress"]; int port = int.Parse(System.Configuration.ConfigurationManager.AppSettings["Port"]); IPEndPoint thePoint = new IPEndPoint(IPAddress.Parse(strIP), port); TCPConnection.StartListening(thePoint, false);
客户端连接代码为:
//从配置文件中获取IP IPAddress = System.Configuration.ConfigurationManager.AppSettings["IPAddress"]; //从配置文件中获取端口 Port = int.Parse(System.Configuration.ConfigurationManager.AppSettings["Port"]); //连接信息类 connInfo = new ConnectionInfo(IPAddress, Port); //与服务器端进行连接 newTcpConnection = TCPConnection.GetConnection(connInfo);
www.networkcomms.cn编辑
标签:
原文地址:http://www.cnblogs.com/networkcomms/p/4411697.html