2003-08-10 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Sun, 10 Aug 2003 23:19:48 +0000 (23:19 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Sun, 10 Aug 2003 23:19:48 +0000 (23:19 -0000)
* 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

mcs/class/System/System.Net.Sockets/ChangeLog
mcs/class/System/System.Net.Sockets/UdpClient.cs

index b3a908c22bbfef54900bac9235ab0a481d7d17c8..2138e9a8607139f0e2d39da0c1f1a840a5837780 100644 (file)
@@ -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:
index 77d50299116ef4ea77e57ed41543f1a56d743d45..2a3aed47d989e65ba938639fe13fe340d8b0b843 100644 (file)
@@ -192,11 +192,15 @@ namespace System.Net.Sockets
                public byte [] Receive (ref IPEndPoint remoteEP)\r
                {\r
                        CheckDisposed ();\r
-                       // Length of the array for receiving data??\r
+\r
+                       // Bug 45633: the spec states that we should block until a datagram arrives:\r
+                       // remove the 512 hardcoded value.\r
+\r
+                       // Block until we get it.\r
+                       socket.Poll (-1, SelectMode.SelectRead);\r
+                       \r
                        byte [] recBuffer;\r
                        int available = socket.Available;\r
-                       if (available < 512)\r
-                               available = 512;\r
 \r
                        recBuffer = new byte [available];\r
                        EndPoint endPoint = new IPEndPoint (IPAddress.Any, 0);\r