From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2001-10-07T07:22:17+09:00 Subject: [ruby-talk:22174] Re: dRuby, Linux and ports In article <01100623231217.00793@linux>, Armin Roehrl wrote: >No idea. >please email the code. OK, here's the latest thing I tried, the simple web server on page 478 of Pickaxe (under TCPServer): #websrv.rb require 'socket' port = 80 server = TCPServer.new('127.0.0.1',port) puts "started server on port #{port}" while(session = server.accept) puts "Request: #{session.gets}" session.print "HTTP/1.1 200/OK\r\nContent-type: text/html\r\n\r\n" session.print "

#{Time.now}

\r\n" session.close end #end websrv.rb The above server works if I try to access it from the same machine it is running on: telnet localhost 80 gives a connection message and in netscape I can get to it if I give it: http://localhost But, as I said previously, it is not accessable from other machines on the network. Then I decided to try out a Perl TCP server (from the Perl cookbook): #tcpsrvr.pl use IO::Socket; $server_port = 80; $server = IO::Socket::INET->new(LocalPort => $server_port, Type => SOCK_STREAM, Reuse => 1, Listen => 10 ) or die "couldn't be a tcp server on port $server_port\n"; while ($client = $server->accept()) { print "accept" } close($server) #tcpsrvr.pl With this perl version I can connect from a remote machine. Curiouser and curiouser... Phil