From: Brent Rowland Date: 2001-05-03T16:02:03+09:00 Subject: [ruby-talk:14583] Re: basic socket question ----- Original Message ----- From: "R. Mark Volkmann" > This should be an easy one for anyone that has successfully used sockets in > Ruby. > What is wrong with this two-line program? > > require 'socket' > socket = TCPSocket.new('services.xmethods.net', 80) > > I get the following when I run it. > > SocketTest.rb:2:in `new': Invalid argument - "connect(2)" (Errno::EINVAL) > from SocketTest.rb:2 I get this error via the HTTP class a lot. I wrote a load-testing script to exercise a couple of dynamic web sites, and it works nearly flawlessly on my Win2K box at work (a PII 400) but fails _most_ of the time under both Win2K and Linux-Mandrake 7.2 on my home machine (an Athlon 850). It also failed on another PIII 550 running RedHat Linux 6.2. The PII 400 and the PIII 550 are on the same network segment as the dynamic web site. My home machine is on a cable modem. I was speculating that it was a timing issue either with CPU speeds or network speeds. A co-worker who telecommutes can run the script just fine against his local server, but gets errors running against the production server across a dial-up modem connection. I'm using version 1.62 (Cygwin) under Win2K and 1.63 under Linux. I'm fairly disappointed, because I was hoping to write a front end to a web service using XMLRPC, but I can't very well do this if the network code isn't robust. My initial experience was very positive, and I liked the elegant API. Brent Rowland