[#6660] Ruby on Neko ? — Nicolas Cannasse <ncannasse@...>

Hi folks,

14 messages 2005/11/19

[#6672] testing for hardlink with "test(?-, ...)" flawed on Windows — noreply@...

Bugs item #2858, was opened at 2005-11-20 16:35

13 messages 2005/11/20

[#6684] semenatics of if/unless/while statement modifiers — Stefan Kaes <skaes@...>

Hi all,

81 messages 2005/11/21
[#6685] Re: semenatics of if/unless/while statement modifiers — Mauricio Fern疣dez <mfp@...> 2005/11/22

On Tue, Nov 22, 2005 at 08:22:59AM +0900, Stefan Kaes wrote:

[#6686] Re: semenatics of if/unless/while statement modifiers — Stefan Kaes <skaes@...> 2005/11/22

Mauricio Fern疣dez wrote:

[#6687] Re: semenatics of if/unless/while statement modifiers — Eric Hodel <drbrain@...7.net> 2005/11/22

On Nov 21, 2005, at 4:37 PM, Stefan Kaes wrote:

[#6689] Re: semenatics of if/unless/while statement modifiers — Stefan Kaes <skaes@...> 2005/11/22

Eric Hodel wrote:

[#6693] Re: semenatics of if/unless/while statement modifiers — Yukihiro Matsumoto <matz@...> 2005/11/22

Hi,

[#6695] Re: semenatics of if/unless/while statement modifiers — Stefan Kaes <skaes@...> 2005/11/22

Yukihiro Matsumoto wrote:

[#6718] Re: semenatics of if/unless/while statement modifiers — mathew <meta@...> 2005/11/22

[#6722] Re: semenatics of if/unless/while statement modifiers — Stefan Kaes <skaes@...> 2005/11/22

mathew wrote:

[#6707] Re: semenatics of if/unless/while statement modifiers — "David A. Black" <dblack@...> 2005/11/22

Hi --

[#6708] Re: semenatics of if/unless/while statement modifiers — Stefan Kaes <skaes@...> 2005/11/22

David A. Black wrote:

[#6714] Re: semenatics of if/unless/while statement modifiers — "David A. Black" <dblack@...> 2005/11/22

Hi --

[#6717] Re: semenatics of if/unless/while statement modifiers — Stefan Kaes <skaes@...> 2005/11/22

David A. Black wrote:

[#6798] ruby 1.8.4 preview2 — Yukihiro Matsumoto <matz@...>

Hi,

37 messages 2005/11/30

[ ruby-Bugs-2872 ] TCPServer should not use SO_REUSEADDR in Cygwin port

From: noreply@...
Date: 2005-11-23 16:46:01 UTC
List: ruby-core #6765
Bugs item #2872, was opened at 2005-11-23 11:36
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2872&group_id=426

Category: Standard Library
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Andrew Wason (awason)
Assigned to: Nobody (None)
Summary: TCPServer should not use SO_REUSEADDR in Cygwin port

Initial Comment:
SO_REUSEADDR behaves strangely under Win32, it allows multiple LISTENs on the same port with indeterminate results. On other platforms SO_REUSEADDR only allows binding to a port not in use or in the TIME_WAIT state.

"This socket option tells the kernel that even if this port is busy (in the TIME_WAIT state), go ahead and reuse it anyway.  If it is busy, but with another state, you will still get an address already in use error."
http://www.unixguide.net/network/socketfaq/4.5.shtml

"Once the second sockey has successfully bound, the behvaior for all sockets bound to that port is indeterminate."
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/using_so_reuseaddr_and_so_exclusiveaddruse.asp

In Ruby 1.8.2/1.8.3, ext/socket/socket.c does not set SO_REUSEADDR for TCPServer if _WIN32 is defined, so things work normally in the i386-mswin32 builds. But the i386-cygwin builds do set SO_REUSEADDR and so weird things can happen.

So in socket.c init_inetsock_internal(), this code should also not be compiled for Cygwin (__CYGWIN__):

	if (type == INET_SERVER) {
#ifndef _WIN32
	    status = 1;
	    setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
		       (char*)&status, sizeof(status));
#endif

Here is a comparison of current mswin32 and cygwin behaviors:

== Cygwin, 2 process actively listening to same port

$ ruby -v
ruby 1.8.3 (2005-09-21) [i386-cygwin]

# From two different consoles:
$ ruby -rsocket -e 'TCPServer.new("localhost", 3900).accept'
$ ruby -rsocket -e 'TCPServer.new("localhost", 3900).accept'

$ netstat -a -p TCP | grep 3900
  TCP    jello:3900             jello:0                LISTENING
  TCP    jello:3900             jello:0                LISTENING


== MSWIN32, 2nd process correctly fails with EADDRINUSE

C:\>ruby -v
ruby 1.8.2 (2004-12-25) [i386-mswin32]

# From two different consoles:
C:\>ruby -rsocket -e 'TCPServer.new("localhost", 3900).accept'
C:\>ruby -rsocket -e 'TCPServer.new("localhost", 3900).accept'
-e:1:in `initialize': Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2) (Errno::EADDRINUSE)
        from -e:1:in `new'
        from -e:1



----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2872&group_id=426

In This Thread

Prev Next