[Mono-dev] Socket Send/Receive Timeout patch

Jacob Gladish jacobgladish at yahoo.com
Thu May 1 21:08:14 EDT 2008


This fixes the problem I previously posted regrading NetworkStream Read/Write Timeout properties.

Index: Socket.cs
===================================================================
--- Socket.cs   (revision 101631)
+++ Socket.cs   (working copy)
@@ -1166,9 +1166,12 @@
                                if (disposed && closed)
                                        throw new ObjectDisposedException (GetType ().ToString ());

-                               return (int)GetSocketOption(
+                               int opt = (int)GetSocketOption(
                                        SocketOptionLevel.Socket,
                                        SocketOptionName.SendTimeout);
+                               if (opt == 0)
+                                   opt = -1;
+                               return opt;
                        }
                        set {
                                if (disposed && closed)
@@ -1195,10 +1198,12 @@
                        get {
                                if (disposed && closed)
                                        throw new ObjectDisposedException (GetType ().ToString ());
-
-                               return (int)GetSocketOption(
+                               int opt = (int)GetSocketOption(
                                        SocketOptionLevel.Socket,
                                        SocketOptionName.ReceiveTimeout);
+                               if (opt == 0)
+                                   opt = -1;
+                               return opt;
                        }
                        set {
                                if (disposed && closed)


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


More information about the Mono-devel-list mailing list