Tries to anticipate .NET TcpClient.GetStream () behavior regarding the use of an ephemeral port in a multi-threaded environment

I am wondering if anyone has any experience with this ...

I am doing multithreading of the current batch process that makes a request through .NET TCPClient to a remote server.

We know that we are connecting to a remote server on the same port through several streams, since we have several instances of the serial processing application that connect to the remote server on the same port.

However, I'm not sure what will happen if I make multiple TCPClient.GetStream () requests using multiple threads in the same application - regarding the local ephemeral (short) port.

If the remote server knows that it should send responses back to the ephemeral port from which the request originated, are there any guarantees that each thread will use a different ephemeral port for the request - or is it likely to use the same port?

In context, this is a card processing application.

Hope this makes sense.

+3
source share
1 answer

, , . Socket API- , ( /), , . , . , .

Windows 49152-65535 ( ~ 16k ), Windows, .

+3

Source: https://habr.com/ru/post/1753680/


All Articles