| | | 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) |
| | 499 | 11 | | { |
| | 499 | 12 | | socket.NoDelay = options.NoDelay; |
| | | 13 | | |
| | 499 | 14 | | if (options.ReceiveBufferSize is int receiveSize) |
| | 16 | 15 | | { |
| | 16 | 16 | | socket.ReceiveBufferSize = receiveSize; |
| | 16 | 17 | | } |
| | 499 | 18 | | if (options.SendBufferSize is int sendSize) |
| | 16 | 19 | | { |
| | 16 | 20 | | socket.SendBufferSize = sendSize; |
| | 16 | 21 | | } |
| | 499 | 22 | | } |
| | | 23 | | } |