可用的TCP侦听器列表
问题描述:
我使用以下代码启动TCP侦听器
I hav used following code to start the TCP Listener
TcpListener serverSocket = new TcpListener(8888);
serverSocket.Start();
我使用以下代码在LAN中找到所有可用的听众
I hav used following code to find All Available Listeners in LAN
Console.WriteLine("Active TCP Listeners");
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
IPEndPoint[] endPoints = properties.GetActiveTcpListeners();
foreach (IPEndPoint e in endPoints)
{
Console.WriteLine(e.ToString());
}
但TCP侦听器已经started..i可以将TCP侦听器与我的TCP客户端连接..
但是我无法使用 properties.GetActiveTcpListeners()方法找到活动的TCP侦听器IP .. b $ b
请帮助我..
先谢谢你..
But the TCP Listener has been started..i can connect the TCP listenrs with my TCP Client..
but i cannot find the active TCP Listeners IP by using properties.GetActiveTcpListeners() method..
Kindly help me on this..
Thanks in Advance..
答
你好Dinesh,
您写道: 我找不到活动的TCP侦听器IP使用properties.GetActiveTcpListeners()
如果我理解正确你试图得到听众的 IP ,是对的吗?
如果是这样,这没有意义,请参阅 -GetActiveTcpListerens
方法仅适用于本地计算机上的侦听器 。
干杯,
Edo
Hi Dinesh,
You wrote: "i cannot find the active TCP Listeners IP by using properties.GetActiveTcpListeners()"
If I understand correctly you tried to get the IP of the listener, is that right?
If so, this does not make sense, see - theGetActiveTcpListerens
method only works for listeners on the local computer.
Cheers,
Edo