Skip to content

Commit 76e2ca3

Browse files
committed
Increase the buffer size for ping reply
Avoid Windows socket error code WSAEMSGSIZE when receiving the ping reply for larger sent payloads.
1 parent 82ffc89 commit 76e2ca3

File tree

1 file changed

+2
-2
lines changed
  • mcs/class/System/System.Net.NetworkInformation

1 file changed

+2
-2
lines changed

mcs/class/System/System.Net.NetworkInformation/Ping.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,11 @@ private PingReply SendPrivileged (IPAddress address, int timeout, byte [] buffer
249249
var sw = Stopwatch.StartNew ();
250250

251251
// receive
252-
bytes = new byte [100];
252+
bytes = new byte [bytes.Length + 40];
253253
do {
254254
EndPoint endpoint = target;
255255
SocketError error = 0;
256-
int rc = s.ReceiveFrom (bytes, 0, 100, SocketFlags.None,
256+
int rc = s.ReceiveFrom (bytes, 0, bytes.Length, SocketFlags.None,
257257
ref endpoint, out error);
258258

259259
if (error != SocketError.Success) {

0 commit comments

Comments
 (0)