FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Where is the right place to config socket buffer size #58 · StudyWithJeffrey/NetCoreServer@fd4fdc0 · GitHub

Repository navigation

Commit fd4fdc0

Browse files
committed
Where is the right place to config socket buffer size chronoxor#58
1 parent 180e99c commit fd4fdc0

11 files changed

Lines changed: 35 additions & 243 deletions

File tree

‎.appveyor.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Specify version format
2-
version: "3.0.11.{build}"
2+
version: "3.0.12.{build}"
33

44
# Image to use
55
image: Visual Studio 2019

‎source/NetCoreServer/NetCoreServer.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.1</TargetFramework>
5-
<Version>3.0.11</Version>
5+
<Version>3.0.12</Version>
66
<Authors>Ivan Shynkarenka</Authors>
77
<Copyright>Copyright (c) 2019-2020 Ivan Shynkarenka</Copyright>
88
<RepositoryUrl>https://github.com/chronoxor/NetCoreServer</RepositoryUrl>

‎source/NetCoreServer/SslClient.cs‎

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -98,49 +98,11 @@ public SslClient(SslContext context, IPEndPoint endpoint)
9898
/// <summary>
9999
/// Option: receive buffer size
100100
/// </summary>
101-
public int OptionReceiveBufferSize
102-
{
103-
get => Socket.ReceiveBufferSize;
104-
set => Socket.ReceiveBufferSize = value;
105-
}
101+
public int OptionReceiveBufferSize { get; set; } = 8192;
106102
/// <summary>
107103
/// Option: send buffer size
108104
/// </summary>
109-
public int OptionSendBufferSize
110-
{
111-
get => Socket.SendBufferSize;
112-
set => Socket.SendBufferSize = value;
113-
}
114-
/// <summary>
115-
/// Option: receive timeout in milliseconds
116-
/// </summary>
117-
/// <remarks>
118-
/// The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.
119-
/// </remarks>
120-
public int OptionReceiveTimeout
121-
{
122-
get => Socket.ReceiveTimeout;
123-
set => Socket.ReceiveTimeout = value;
124-
}
125-
/// <summary>
126-
/// Option: send timeout in milliseconds
127-
/// </summary>
128-
/// <remarks>
129-
/// The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.
130-
/// </remarks>
131-
public int OptionSendTimeout
132-
{
133-
get => Socket.SendTimeout;
134-
set => Socket.SendTimeout = value;
135-
}
136-
/// <summary>
137-
/// Option: linger state
138-
/// </summary>
139-
public LingerOption OptionLingerState
140-
{
141-
get => Socket.LingerState;
142-
set => Socket.LingerState = value;
143-
}
105+
public int OptionSendBufferSize { get; set; } = 8192;
144106

145107
#region Connect/Disconnect client
146108

‎source/NetCoreServer/SslServer.cs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ public SslServer(SslContext context, IPEndPoint endpoint)
107107
/// This option will enable/disable SO_EXCLUSIVEADDRUSE if the OS support this feature
108108
/// </remarks>
109109
public bool OptionExclusiveAddressUse { get; set; }
110+
/// <summary>
111+
/// Option: receive buffer size
112+
/// </summary>
113+
public int OptionReceiveBufferSize { get; set; } = 8192;
114+
/// <summary>
115+
/// Option: send buffer size
116+
/// </summary>
117+
public int OptionSendBufferSize { get; set; } = 8192;
110118

111119
#region Start/Stop server
112120

‎source/NetCoreServer/SslSession.cs‎

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public SslSession(SslServer server)
2121
{
2222
Id = Guid.NewGuid();
2323
Server = server;
24+
OptionReceiveBufferSize = server.OptionReceiveBufferSize;
25+
OptionSendBufferSize = server.OptionSendBufferSize;
2426
}
2527

2628
/// <summary>
@@ -57,49 +59,11 @@ public SslSession(SslServer server)
5759
/// <summary>
5860
/// Option: receive buffer size
5961
/// </summary>
60-
public int OptionReceiveBufferSize
61-
{
62-
get => Socket.ReceiveBufferSize;
63-
set => Socket.ReceiveBufferSize = value;
64-
}
62+
public int OptionReceiveBufferSize { get; set; } = 8192;
6563
/// <summary>
6664
/// Option: send buffer size
6765
/// </summary>
68-
public int OptionSendBufferSize
69-
{
70-
get => Socket.SendBufferSize;
71-
set => Socket.SendBufferSize = value;
72-
}
73-
/// <summary>
74-
/// Option: receive timeout in milliseconds
75-
/// </summary>
76-
/// <remarks>
77-
/// The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.
78-
/// </remarks>
79-
public int OptionReceiveTimeout
80-
{
81-
get => Socket.ReceiveTimeout;
82-
set => Socket.ReceiveTimeout = value;
83-
}
84-
/// <summary>
85-
/// Option: send timeout in milliseconds
86-
/// </summary>
87-
/// <remarks>
88-
/// The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.
89-
/// </remarks>
90-
public int OptionSendTimeout
91-
{
92-
get => Socket.SendTimeout;
93-
set => Socket.SendTimeout = value;
94-
}
95-
/// <summary>
96-
/// Option: linger state
97-
/// </summary>
98-
public LingerOption OptionLingerState
99-
{
100-
get => Socket.LingerState;
101-
set => Socket.LingerState = value;
102-
}
66+
public int OptionSendBufferSize { get; set; } = 8192;
10367

10468
#region Connect/Disconnect session
10569

‎source/NetCoreServer/TcpClient.cs‎

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -83,49 +83,11 @@ public TcpClient(IPEndPoint endpoint)
8383
/// <summary>
8484
/// Option: receive buffer size
8585
/// </summary>
86-
public int OptionReceiveBufferSize
87-
{
88-
get => Socket.ReceiveBufferSize;
89-
set => Socket.ReceiveBufferSize = value;
90-
}
86+
public int OptionReceiveBufferSize { get; set; } = 8192;
9187
/// <summary>
9288
/// Option: send buffer size
9389
/// </summary>
94-
public int OptionSendBufferSize
95-
{
96-
get => Socket.SendBufferSize;
97-
set => Socket.SendBufferSize = value;
98-
}
99-
/// <summary>
100-
/// Option: receive timeout in milliseconds
101-
/// </summary>
102-
/// <remarks>
103-
/// The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.
104-
/// </remarks>
105-
public int OptionReceiveTimeout
106-
{
107-
get => Socket.ReceiveTimeout;
108-
set => Socket.ReceiveTimeout = value;
109-
}
110-
/// <summary>
111-
/// Option: send timeout in milliseconds
112-
/// </summary>
113-
/// <remarks>
114-
/// The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.
115-
/// </remarks>
116-
public int OptionSendTimeout
117-
{
118-
get => Socket.SendTimeout;
119-
set => Socket.SendTimeout = value;
120-
}
121-
/// <summary>
122-
/// Option: linger state
123-
/// </summary>
124-
public LingerOption OptionLingerState
125-
{
126-
get => Socket.LingerState;
127-
set => Socket.LingerState = value;
128-
}
90+
public int OptionSendBufferSize { get; set; } = 8192;
12991

13092
#region Connect/Disconnect client
13193

‎source/NetCoreServer/TcpServer.cs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ public TcpServer(IPEndPoint endpoint)
9898
/// This option will enable/disable SO_EXCLUSIVEADDRUSE if the OS support this feature
9999
/// </remarks>
100100
public bool OptionExclusiveAddressUse { get; set; }
101+
/// <summary>
102+
/// Option: receive buffer size
103+
/// </summary>
104+
public int OptionReceiveBufferSize { get; set; } = 8192;
105+
/// <summary>
106+
/// Option: send buffer size
107+
/// </summary>
108+
public int OptionSendBufferSize { get; set; } = 8192;
101109

102110
#region Start/Stop server
103111

‎source/NetCoreServer/TcpSession.cs‎

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public TcpSession(TcpServer server)
2020
{
2121
Id = Guid.NewGuid();
2222
Server = server;
23+
OptionReceiveBufferSize = server.OptionReceiveBufferSize;
24+
OptionSendBufferSize = server.OptionSendBufferSize;
2325
}
2426

2527
/// <summary>
@@ -56,49 +58,11 @@ public TcpSession(TcpServer server)
5658
/// <summary>
5759
/// Option: receive buffer size
5860
/// </summary>
59-
public int OptionReceiveBufferSize
60-
{
61-
get => Socket.ReceiveBufferSize;
62-
set => Socket.ReceiveBufferSize = value;
63-
}
61+
public int OptionReceiveBufferSize { get; set; } = 8192;
6462
/// <summary>
6563
/// Option: send buffer size
6664
/// </summary>
67-
public int OptionSendBufferSize
68-
{
69-
get => Socket.SendBufferSize;
70-
set => Socket.SendBufferSize = value;
71-
}
72-
/// <summary>
73-
/// Option: receive timeout in milliseconds
74-
/// </summary>
75-
/// <remarks>
76-
/// The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.
77-
/// </remarks>
78-
public int OptionReceiveTimeout
79-
{
80-
get => Socket.ReceiveTimeout;
81-
set => Socket.ReceiveTimeout = value;
82-
}
83-
/// <summary>
84-
/// Option: send timeout in milliseconds
85-
/// </summary>
86-
/// <remarks>
87-
/// The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.
88-
/// </remarks>
89-
public int OptionSendTimeout
90-
{
91-
get => Socket.SendTimeout;
92-
set => Socket.SendTimeout = value;
93-
}
94-
/// <summary>
95-
/// Option: linger state
96-
/// </summary>
97-
public LingerOption OptionLingerState
98-
{
99-
get => Socket.LingerState;
100-
set => Socket.LingerState = value;
101-
}
65+
public int OptionSendBufferSize { get; set; } = 8192;
10266

10367
#region Connect/Disconnect session
10468

‎source/NetCoreServer/UdpClient.cs‎

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -94,49 +94,11 @@ public UdpClient(IPEndPoint endpoint)
9494
/// <summary>
9595
/// Option: receive buffer size
9696
/// </summary>
97-
public int OptionReceiveBufferSize
98-
{
99-
get => Socket.ReceiveBufferSize;
100-
set => Socket.ReceiveBufferSize = value;
101-
}
97+
public int OptionReceiveBufferSize { get; set; } = 8192;
10298
/// <summary>
10399
/// Option: send buffer size
104100
/// </summary>
105-
public int OptionSendBufferSize
106-
{
107-
get => Socket.SendBufferSize;
108-
set => Socket.SendBufferSize = value;
109-
}
110-
/// <summary>
111-
/// Option: receive timeout in milliseconds
112-
/// </summary>
113-
/// <remarks>
114-
/// The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.
115-
/// </remarks>
116-
public int OptionReceiveTimeout
117-
{
118-
get => Socket.ReceiveTimeout;
119-
set => Socket.ReceiveTimeout = value;
120-
}
121-
/// <summary>
122-
/// Option: send timeout in milliseconds
123-
/// </summary>
124-
/// <remarks>
125-
/// The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.
126-
/// </remarks>
127-
public int OptionSendTimeout
128-
{
129-
get => Socket.SendTimeout;
130-
set => Socket.SendTimeout = value;
131-
}
132-
/// <summary>
133-
/// Option: linger state
134-
/// </summary>
135-
public LingerOption OptionLingerState
136-
{
137-
get => Socket.LingerState;
138-
set => Socket.LingerState = value;
139-
}
101+
public int OptionSendBufferSize { get; set; } = 8192;
140102

141103
#region Connect/Disconnect client
142104

‎source/NetCoreServer/UdpServer.cs‎

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -95,49 +95,11 @@ public UdpServer(IPEndPoint endpoint)
9595
/// <summary>
9696
/// Option: receive buffer size
9797
/// </summary>
98-
public int OptionReceiveBufferSize
99-
{
100-
get => Socket.ReceiveBufferSize;
101-
set => Socket.ReceiveBufferSize = value;
102-
}
98+
public int OptionReceiveBufferSize { get; set; } = 8192;
10399
/// <summary>
104100
/// Option: send buffer size
105101
/// </summary>
106-
public int OptionSendBufferSize
107-
{
108-
get => Socket.SendBufferSize;
109-
set => Socket.SendBufferSize = value;
110-
}
111-
/// <summary>
112-
/// Option: receive timeout in milliseconds
113-
/// </summary>
114-
/// <remarks>
115-
/// The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.
116-
/// </remarks>
117-
public int OptionReceiveTimeout
118-
{
119-
get => Socket.ReceiveTimeout;
120-
set => Socket.ReceiveTimeout = value;
121-
}
122-
/// <summary>
123-
/// Option: send timeout in milliseconds
124-
/// </summary>
125-
/// <remarks>
126-
/// The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.
127-
/// </remarks>
128-
public int OptionSendTimeout
129-
{
130-
get => Socket.SendTimeout;
131-
set => Socket.SendTimeout = value;
132-
}
133-
/// <summary>
134-
/// Option: linger state
135-
/// </summary>
136-
public LingerOption OptionLingerState
137-
{
138-
get => Socket.LingerState;
139-
set => Socket.LingerState = value;
140-
}
102+
public int OptionSendBufferSize { get; set; } = 8192;
141103

142104
#region Connect/Disconnect client
143105

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL