1

I have coded TCPClient() in C# to communicate with another device on LAN. I only have to specify the target IP and port number.

Now I am coding something quite similar to it. However, it specifies that the client port from my PC has to be something greater than 1024. How can I configure that? does this mean that VS automatically takes care of that if not specified?

4

1 回答 1

2

TcpClient(IPEndPoint)可用于指定客户端端口(仅IPAddress.Any用于地址部分)。如Socket.Bindwikipedia:ephemeral_port中所述,默认情况下将使用高于 1024 的端口。

于 2013-03-26T19:37:52.590 回答