diff options
author | Miguel de Icaza <miguel@gnome.org> | 2003-08-11 03:19:48 +0400 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2003-08-11 03:19:48 +0400 |
commit | 56a8c0cb34e509be72da583590a90fd6f79009c7 (patch) | |
tree | 63384e2fef9285e08a0eb898e73d40e1c15173fe /mcs/class/System/System.Net.Sockets | |
parent | 639a1707a81fa96c30cb0d58e82582c0a02a111d (diff) |
2003-08-10 Miguel de Icaza <miguel@ximian.com>
* UdpClient.cs (Receive): Fix Bug 45633; We should do a blocking
call until a datagram is arrives from the remote host. This
removes the 512 "magic" buffer size when we did not have any data.
svn path=/trunk/mcs/; revision=17237
Diffstat (limited to 'mcs/class/System/System.Net.Sockets')
-rw-r--r-- | mcs/class/System/System.Net.Sockets/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/class/System/System.Net.Sockets/UdpClient.cs | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/mcs/class/System/System.Net.Sockets/ChangeLog b/mcs/class/System/System.Net.Sockets/ChangeLog index b3a908c22bb..2138e9a8607 100644 --- a/mcs/class/System/System.Net.Sockets/ChangeLog +++ b/mcs/class/System/System.Net.Sockets/ChangeLog @@ -1,3 +1,9 @@ +2003-08-10 Miguel de Icaza <miguel@ximian.com> + + * UdpClient.cs (Receive): Fix Bug 45633; We should do a blocking + call until a datagram is arrives from the remote host. This + removes the 512 "magic" buffer size when we did not have any data. + 2003-07-31 Gonzalo Paniagua Javier <gonzalo@ximian.com> * NetworkStream.cs: diff --git a/mcs/class/System/System.Net.Sockets/UdpClient.cs b/mcs/class/System/System.Net.Sockets/UdpClient.cs index 77d50299116..2a3aed47d98 100644 --- a/mcs/class/System/System.Net.Sockets/UdpClient.cs +++ b/mcs/class/System/System.Net.Sockets/UdpClient.cs @@ -192,11 +192,15 @@ namespace System.Net.Sockets public byte [] Receive (ref IPEndPoint remoteEP)
{
CheckDisposed ();
- // Length of the array for receiving data??
+
+ // Bug 45633: the spec states that we should block until a datagram arrives:
+ // remove the 512 hardcoded value.
+
+ // Block until we get it.
+ socket.Poll (-1, SelectMode.SelectRead);
+
byte [] recBuffer;
int available = socket.Available;
- if (available < 512)
- available = 512;
recBuffer = new byte [available];
EndPoint endPoint = new IPEndPoint (IPAddress.Any, 0);
|