码迷,mamicode.com
首页 > 其他好文 > 详细

微风IM 3.3 系列之二 服务器开始监听与客户端连接

时间:2015-04-09 21:41:18      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:

通信框架为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编辑

微风IM 3.3 系列之二 服务器开始监听与客户端连接

标签:

原文地址:http://www.cnblogs.com/networkcomms/p/4411697.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!