View Single Post
  #3 (permalink)  
Old 07-27-2004
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 926
Quote:
Originally posted by wodi
disable in Network.cs the Mono fix

if(ready && !socket.Connected)
{
goto repeatConnect;
}

around line 404.

It will work then on Windows with .NET. Any explanation please!
Hi Wodi,

the problem is that, with Mono under Linux, there is a problem in the Connect() behavior: a select after a non-blocking connect returns a writable file descriptor (indicating that the connection is established) when, in fact, the connection is not established. Interestingly, restarting the call to select doesn't fix this (that is, the socket remains unconnected thereafter), but restarting the connect call does.

I tried this hack with .NET under Windows as well, and had no problems, which is why I left it enabled for both .NET and Mono.

Quote:

Code:
#if __MonoCS__		    
            if(ready && !socket.Connected)
           {
           goto repeatConnect;
           }
#endif
Ah, that isn't quite the correct fix. The problem with __MonoCS__ is that this is a compile-time test. So, if you compile something with mcs and then copy the binaries to a Windows machine with a .NET run time, it will still fail. One correct (simple) fix for now is to change the test to read:

Code:
if(ready && System.Type.GetType("Mono.Runtime") != null && !socket.Connected)
Thanks for the bug report, Wodi. This will be fixed for the next release, of course.

Cheers,

Michi.
Reply With Quote