Re: select on windows platform

[email protected] (Armin Armbruster) Wed, 05 Mar 2003 15:50:51 +0100 (CET)
Newsgroups gmane.comp.lang.ruby.german
Message-ID <[email protected]>
Beseilius Heiko schrieb:
> Hello all members of this mailing list,
> 
> Following ruby(1.6.8) code has different behavior on
> different platforms:
> select([$stdin], nil, nil, nil) 
> On solaris an cygwin platforms the current thread sleeps
> forever.
> On windows platforms the function returns immediately. 
> Can someone tell me this fact and how should I use the
> select function for
> the same behavior on all platforms?


Hi Heiko,

although I am not 100% sure I think the your problem has to do with the
implementation of sockets in Windows. I read in a C++ book (Visual C++
6.0 Kompendium) that the WinSock-DLL is not 100% compatible with BSD
sockets. One of the important differences is, that in Windows socket
descpriptors and file descriptors are not interchangable. I guess that
means that in Windows you can not select on a file descriptor like
stdin. You probably have to use another way to read from stdin.

Cheers,
Armin