[Mono-list] "Operation on non-blocking socket would block" exception with TcpClient

Miguel de Icaza miguel at ximian.com
Mon Mar 20 17:31:47 EST 2006


Captain Gonzalo,

> > using System.IO;
> > using System.Net;
> > using System.Net.Sockets;
> > public class test_t {
> >   public static void Main() {
> >     IPEndPoint endpoint =
> >       new IPEndPoint(Dns.GetHostByName("localhost").AddressList[0], 8080);
> >     TcpListener listener = new TcpListener(endpoint);
> >     listener.Start();
> >     TcpClient client = listener.AcceptTcpClient();
> >     client.ReceiveTimeout = 10;
> >     Stream stream = client.GetStream();
> >     stream.ReadByte();
> >     client.Close();
> >   }
> > }
> 
> Is that a 10 milliseconds timeout? No wonder that this thing fails when
> reading.

Captain Gonzalo, I can confirm that the timeout is 10 milliseconds.  A
quick lookup in the class reference documentation corroborates your
theory.

This has to be the second time that someone complains about that bug.

Miguel.


More information about the Mono-list mailing list