Always let the OS auto-tune the socket send/receive buffer size (#1821)

Remove the explicit SendBufferSize/ReceiveBufferSize assignment
from both SocketConnect and SocketConnectAsync. This lets the
operating system auto-tune the buffer for every connection by
default, and resolves the sync/async multiplier mismatch.
This commit is contained in:
Hai Vo
2026-08-23 00:33:11 +07:00
committed by GitHub
parent f7d2ac173b
commit ace38009ee
@@ -47,9 +47,6 @@ namespace Renci.SshNet.Connection
{
SocketAbstraction.Connect(socket, endPoint, timeout);
const int socketBufferSize = 10 * Session.MaximumSshPacketSize;
socket.SendBufferSize = socketBufferSize;
socket.ReceiveBufferSize = socketBufferSize;
return socket;
}
catch (Exception)
@@ -77,9 +74,6 @@ namespace Renci.SshNet.Connection
{
await SocketAbstraction.ConnectAsync(socket, endPoint, cancellationToken).ConfigureAwait(false);
const int socketBufferSize = 2 * Session.MaximumSshPacketSize;
socket.SendBufferSize = socketBufferSize;
socket.ReceiveBufferSize = socketBufferSize;
return socket;
}
catch (Exception)