Is there a way to specify which NIC the traffic goes? #2936
Answered
by
MihaZupan
rodolfo-sousa
asked this question in
Q&A
-
Is there a way to specify which network card the traffic of a specific route goes?
|
Beta Was this translation helpful? Give feedback.
Answered by
MihaZupan
Sep 4, 2025
Replies: 1 comment 4 replies
-
You can customize how the socket is created by setting the Socket socket = new Socket(SocketType.Stream, ProtocolType.Tcp) { NoDelay = true };
try
{
// Bind here
await socket.ConnectAsync(endPoint, cancellationToken);
return new NetworkStream(socket, ownsSocket: true);
}
catch
{
socket.Dispose();
throw;
} |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
MihaZupan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can customize how the socket is created by setting the
SocketsHttpHandler.ConnectCallback
, presumably callingBind
there should work.For reference the default implementation is