| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | using System.Net.Sockets; |
| | 4 | |
|
| | 5 | | namespace IceRpc.Transports.Tcp.Internal; |
| | 6 | |
|
| | 7 | | internal static class SocketExtensions |
| | 8 | | { |
| | 9 | | /// <summary>Configures a socket.</summary> |
| | 10 | | internal static void Configure(this Socket socket, TcpTransportOptions options) |
| 500 | 11 | | { |
| 500 | 12 | | socket.NoDelay = options.NoDelay; |
| | 13 | |
|
| 500 | 14 | | if (options.ReceiveBufferSize is int receiveSize) |
| 16 | 15 | | { |
| 16 | 16 | | socket.ReceiveBufferSize = receiveSize; |
| 16 | 17 | | } |
| 500 | 18 | | if (options.SendBufferSize is int sendSize) |
| 16 | 19 | | { |
| 16 | 20 | | socket.SendBufferSize = sendSize; |
| 16 | 21 | | } |
| 500 | 22 | | } |
| | 23 | | } |