[Mono-list] Reading from a NonBlocking socket closes the connection

Aleksandar Dezelin dezelin32@fastmail.fm
Tue, 28 Dec 2004 13:31:48 +0100


Gonzalo Paniagua Javier wrote:
> On Sun, 2004-12-26 at 15:52 -0800, scott@imeem.com wrote:
> 
>>IPEndPoint endpoint = new
>>IPEndPoint(IPAddress.Parse("127.0.0.1"),80); //
>>pick a destination which doesn't send data back
>>Socket sock = new (Socket(endPoint,AddressFamily, SocketType.Stream,
>>ProtocolType.Tcp);
>>sock.Connect(endPoint);
>>
>>if(sock.Connected) {
>>    try {
>>        sock.Blocking = false;
>>        byte[] test = new byte[8];
>>        sock.Receive(test);
>>    }
>>    catch (Exception e)
>>    {
>>        Console.WriteLine("Connected = " + sock.Connected);
>>
>>    }
>>}
> 
> 
> This is now fixed in svn HEAD and 1-0.
> 
> Thanks.
> 
> -Gonzalo
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 

I have a similar problem in my app when trying to pass some data via 
remoting from .NET client to Mono remoting server. When I try to pass 
data for the first time it throws an exception in (I think) 
Socket.ReadBytes saying that the underlaying socket is closed (in .NET 
client), but when I do that again, it passes those data without any 
problems. Does this bug is possibly causing weird behaviour of sockets 
in that remoting application?

Cheers,
Aleksandar Dezelin



-- 
Linux is like wigwham - no windows, no gates, and apache inside...