Skip to content
Discussion options

You must be logged in to vote

You can customize how the socket is created by setting the SocketsHttpHandler.ConnectCallback, presumably calling Bind there should work.
For reference the default implementation is

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;
}

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@rodolfo-sousa
Comment options

@MihaZupan
Comment options

@rodolfo-sousa
Comment options

@MihaZupan
Comment options

Answer selected by MihaZupan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants