下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。
内存溢出小编现在分享给大家,也给大家做个参考。
using System;using System.Collections.Generic;using System.Text;using System.Net.networkinformation; namespace test{ class Program { static voID Main(string[] args) { GetTcpConnections(); } public static voID GetTcpConnections() { //code from http://www.shareJs.com/codes IPGlobalPropertIEs propertIEs = IPGlobalPropertIEs.GetIPGlobalPropertIEs(); TcpConnectioninformation[] connections = propertIEs.GetActiveTcpConnections(); foreach (TcpConnectioninformation t in connections) { Console.Write("Local endpoint: {0} ",t.LocalEndPoint.ToString()); Console.Write("Remote endpoint: {0} ",t.RemoteEndPoint.ToString()); Console.Writeline("{0}",t.State); } Console.Writeline(); Console.Readline(); } }} {--运行结果:-- Local endpoint: 127.0.0.1:1025 Remote endpoint: 127.0.0.1:1026 EstablishedLocal endpoint: 127.0.0.1:1026 Remote endpoint: 127.0.0.1:1025 EstablishedLocal endpoint: 127.0.0.1:1028 Remote endpoint: 127.0.0.1:16992 CloseWaitLocal endpoint: 127.0.0.1:1110 Remote endpoint: 127.0.0.1:4900 EstablishedLocal endpoint: 127.0.0.1:2754 Remote endpoint: 127.0.0.1:1110 CloseWaitLocal endpoint: 127.0.0.1:2762 Remote endpoint: 127.0.0.1:1110 CloseWaitLocal endpoint: 127.0.0.1:2773 Remote endpoint: 127.0.0.1:1110 CloseWaitLocal endpoint: 127.0.0.1:2913 Remote endpoint: 127.0.0.1:1110 CloseWaitLocal endpoint: 127.0.0.1:3014 Remote endpoint: 127.0.0.1:1110 CloseWaitLocal endpoint: 127.0.0.1:3531 Remote endpoint: 127.0.0.1:1110 CloseWaitLocal endpoint: 127.0.0.1:4012 Remote endpoint: 127.0.0.1:1110 CloseWaitLocal endpoint: 127.0.0.1:4900 Remote endpoint: 127.0.0.1:1110 Established
以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
总结以上是内存溢出为你收集整理的C#检测远程计算机端口是否打开全部内容,希望文章能够帮你解决C#检测远程计算机端口是否打开所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)