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

Gonzalo Paniagua Javier gonzalo at ximian.com
Fri Mar 17 15:45:06 EST 2006


On Fri, 2006-03-17 at 14:38 +0000, Colin JN Breame wrote:

> 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.

-Gonzalo




More information about the Mono-list mailing list