[Mono-dev] socket read timeout
Jacob Gladish
jacobgladish at yahoo.com
Wed Apr 23 19:28:04 EDT 2008
I ran across a case where mono 1.9 deviates from the MS apis. The following code demonstates that the ReadTimeout propery on a NetworkStream is 0 where the MS .NET apis return -1.
using System;
using System.Net.Sockets;
public class NSTest {
public static void Main (String[] args) {
TcpClient clnt = new TcpClient ("www.yahoo.com", 80);
NetworkStream ns = new NetworkStream (clnt.Client);
Int32 to = ns.ReadTimeout;
Console.WriteLine ("Default Timeout: {0}", to);
}
}
I hit this while trying to save the ReadTimeout value then restoring it later which throws an exception. I followed the code through io-layer/sockets.c. It looks like it just uses get/set sockopt. The manpage for getsockopt indicates that 0 is INFINITE whereas it's -1 in .NET.
Not sure if this should be patched and at what layer. It seems as though the 0 should be translated to Timeout.Infinite (-1) on the way out. I'm not sure what layer this should be done in. Probably Sockets.cs. Any suggestions?
-jake
____________________________________________________________________________________
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