Socket problem, Errno::EINVAL. Can someone explain?

Hi, I am having trouble with sockets on my development machine (windows & cygwin). I've done a quick test on a linux box and it doesn't seem to show the same behaviour, i.e. it works. Can someone explain why the following error is thrown on windows and not on linux and if there is a workaround to fix it.

--environment.rb---- ##define a socket. I am defining it in environment.rb because I am going to use the socket in some of the models & also a script (running via script/runner) begin     $socket = UDPSocket.open     $socket.bind("",1680) rescue Errno::EADDRINUSE     puts "Error: #{$!}" end

Open two consoles: ----Console 1----- $ ./script/console Loading development environment (Rails 2.0.2)

$socket

=> #<UDPSocket:0x2b5c71558e80>

----Console 2----- $ ./script/console Loading development environment (Rails 2.0.2) Error: Address already in use - bind(2)

$socket

=> #<UDPSocket:0x2b5c71558e80>

$socket.recvfrom(512)

Errno::EINVAL: Invalid argument - recvfrom(2)         from (irb):1:in `recvfrom'         from (irb):1

Why can the second console see the socket but throw an error when I try and use it. Linux doesn't seem to do this, i.e. I can use the socket in either window.

Hi, I am having trouble with sockets on my development machine (windows & cygwin). I've done a quick test on a linux box and it doesn't seem
to show the same behaviour, i.e. it works. Can someone explain why the following error is thrown on windows and
not on linux and if there is a workaround to fix it.

--environment.rb---- ##define a socket. I am defining it in environment.rb because I am going to use the socket in some of the models & also a script (running via script/runner) begin    $socket = UDPSocket.open    $socket.bind("",1680) rescue Errno::EADDRINUSE    puts "Error: #{$!}" end

Open two consoles: ----Console 1----- $ ./script/console Loading development environment (Rails 2.0.2)

$socket

=> #<UDPSocket:0x2b5c71558e80>

----Console 2----- $ ./script/console Loading development environment (Rails 2.0.2) Error: Address already in use - bind(2)

$socket

=> #<UDPSocket:0x2b5c71558e80>

$socket.recvfrom(512)

Errno::EINVAL: Invalid argument - recvfrom(2)        from (irb):1:in `recvfrom'        from (irb):1

The exception occurs when you bind the socket, not when you create it,
so $socket exists in both cases, it's just not bound in the second
console.

Fred