c# winform socket获得客户机IP,端口

//指向远程服务端节点
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(ServerIP), int.Parse(ServerPort));

//获得IP
MessageBox.Show(ipep.Address.ToString());

//获得端口
MessageBox.Show(ipep.Port.ToString());

//获得计算机名
MessageBox.Show(Dns.GetHostName().ToString());



 

黑色头发:http://heisetoufa.iteye.com

你可能感兴趣的:(C++,c,socket,C#,WinForm)