TCPSocket and windows

  • Thread starter Matthew Margolis
  • Start date
M

Matthew Margolis

I can not get a working TCPSocket under windows with ruby 1.8.2. It
just hangs. Is there currently a solution for this problem?

-Matt Margolis
 
B

Bill Kelly

Hi,

From: "Matthew Margolis said:
I can not get a working TCPSocket under windows with ruby 1.8.2. It
just hangs. Is there currently a solution for this problem?

Could you post your code? I've used TCPSocket (and UDPSocket)
heavily under Win32 ruby since, I think version 1.6.4... Currently
running ruby 1.8.2 (2004-12-25) [i386-mswin32].


Regards,

Bill
 
M

Matthew Margolis

Bill said:
Hi,

I can not get a working TCPSocket under windows with ruby 1.8.2. It
just hangs. Is there currently a solution for this problem?

Could you post your code? I've used TCPSocket (and UDPSocket)
heavily under Win32 ruby since, I think version 1.6.4... Currently
running ruby 1.8.2 (2004-12-25) [i386-mswin32].


Regards,

Bill
sure
-----------------
require 'Timeout'
require 'socket'
time =5

begin
Timeout.timeout(time) do
s = TCPSocket.new("google.com", "echo")
puts "fish"
s.close
end
rescue Timeout::Error
puts "Timed out"
end
 
B

Bill Kelly

From: "Matthew Margolis said:
Bill said:
From: "Matthew Margolis said:
I can not get a working TCPSocket under windows with ruby 1.8.2. It
just hangs. Is there currently a solution for this problem?
Could you post your code? I've used TCPSocket (and UDPSocket)
heavily under Win32 ruby since, I think version 1.6.4... Currently
running ruby 1.8.2 (2004-12-25) [i386-mswin32].
sure
-----------------
require 'Timeout'
require 'socket'
time =5

begin
Timeout.timeout(time) do
s = TCPSocket.new("google.com", "echo")
puts "fish"
s.close
end
rescue Timeout::Error
puts "Timed out"
end

Note, the above code also hangs under Linux, too. :)

I think it's just that google.com doesn't answer
connection requests on port 7 (echo).

Here's similar code (in irb on Windows) using http
instead of echo:
=> "Set-Cookie: PREF=ID=5eb25ab2dffff310:TM=1109793965:LM=1109793965:
S=MmppHbq23LjrmaeH; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/;
domain=.google.com\r\n"=> nil


HTH,

Regards,

Bill
 
M

Matthew Margolis

Bill said:
Bill Kelly wrote:

From: "Matthew Margolis" <[email protected]>



I can not get a working TCPSocket under windows with ruby 1.8.2. It
just hangs. Is there currently a solution for this problem?



Could you post your code? I've used TCPSocket (and UDPSocket)
heavily under Win32 ruby since, I think version 1.6.4... Currently
running ruby 1.8.2 (2004-12-25) [i386-mswin32].
sure
-----------------
require 'Timeout'
require 'socket'
time =5

begin
Timeout.timeout(time) do
s = TCPSocket.new("google.com", "echo")
puts "fish"
s.close
end
rescue Timeout::Error
puts "Timed out"
end

Note, the above code also hangs under Linux, too. :)

I think it's just that google.com doesn't answer
connection requests on port 7 (echo).

Here's similar code (in irb on Windows) using http
instead of echo:


=> true

=> nil

=> "HTTP/1.0 200 OK\r\n"

=> "Cache-Control: private\r\n"

=> "Content-Type: text/html\r\n"

=> "Set-Cookie: PREF=ID=5eb25ab2dffff310:TM=1109793965:LM=1109793965:
S=MmppHbq23LjrmaeH; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/;
domain=.google.com\r\n"

=> "Server: GWS/2.1\r\n"

=> "Date: Wed, 02 Mar 2005 20:06:05 GMT\r\n"

=> "Connection: Close\r\n"

=> "\r\n"

=> "<html><head><meta http-equiv=\"content-type\" content=\"text/html;
=> nil


HTH,

Regards,

Bill
Thanks I will give that a try.

-Matt Margolis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top