From: mike@... (Mike Stok) Date: 2003-11-17T10:23:49+09:00 Subject: Re: TCPSocket error In article , Noah wrote: >"Chris Reay" wrote in message >news:7652139e.0311091842.1d170043@posting.google.com... >> "Noah" wrote in message news: >> > So the exact code is: >> > >> > require "socket" >> > t = TCPSocket.new('127.0.0.1', 'http') >> > print t.gets >> > t.close >> > >> > with error: >> > >> > 6sock2.rb:2:in `new': No such file or directory (Errno::ENOENT) >> > from 6sock2.rb:2 >> >> From the Pickaxe book, IO.gets ... >> >> "The stream must be opened for reading or an IOError will be raised." >> >> How about >> >> print t.recv(1024) >> >> That's what I use. Hth. >> >> Chris > >Thanks, but that didn't help. The error happens on the TCPSocket.new >command. This is a wild guess, but might a shared library be missing, or the file used to look up the port of the http service (/etc/services) be missing. I would use something like strace (if it's on a unix-like system) to see if there really is a file missing. If there is a file missing then we can move on. One quick thing might be to try t = TCPSocket.new('127.0.0.1', 80) to see if the problem is in the service name lookup. Hope this helps, Mike -- mike@stok.co.uk | The "`Stok' disclaimers" apply. http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA mike@exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60 http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA