构造 a 有三个重载TcpListener:
public TcpListener(int port);(过时)public TcpListener(IPEndPoint localEP)public TcpListener(IPAddress localaddr, int port)
我想在一个特定的端口上监听,但在所有可用的接口上。有一个重载可以做到这一点,但它被标记为obsolete.
TcpListener在 .NET中的所有接口上侦听特定端口的新首选/非过时方法是什么?
为了帮助起见, anIPEndPoint是:
public IPEndPoint(
IPAddress address,
int port
)
这就是第三个重载。而 anIPAddress作为它的构造函数:
- 一种
byte[] - 一个
Int64 - 一个
byte[]和一个Int64