标签:
服务器端查看都有哪些客户端在线,并查看连接信息
方法如下:
private void button5_Click(object sender, EventArgs e) { try { lock (syncLocker) { LogInfo.LogMessage(DateTime.Now.ToString(), "查看连接信息"); foreach (Connection conn in NetworkComms.GetExistingConnection()) { //本例中 把连接的信息记录到日志中 LogInfo.LogMessage("本地端点" + conn.ConnectionInfo.LocalEndPoint + "远程端点" + conn.ConnectionInfo.RemoteEndPoint, "查看连接信息"); } } } catch (Exception ex) { LogTools.LogException(ex, "button5_Click"); } }
www.networkcomms.cn编辑
标签:
原文地址:http://www.cnblogs.com/networkcomms/p/4333910.html