Socket / net question

I honestly don’t know. I suspect both of our questions are either (a) too
basic for anyone to respond or (b) no one knows what we are on about… I
suspect the later because usually someone responds to the former anyway.

Oh well…

mark

[---------]
“I must hurry back to my comic book store, where I dispense the insults
rather than absorb them.”
[---------]

···

-----Original Message-----
From: web2ed@yahoo.com [mailto:web2ed@yahoo.com]
Sent: 19 October 2002 06:50
To: ruby-talk@ruby-lang.org
Subject: Re: socket / net question…

Since you let the socket Genie out of the bottle: Where can I find
the ruby source for TCPServer and Socket? I can’t find either anywhere
and I built from source.

Also, why must one call `gets’ on one’s TCPserver object before
calling print? This makes no sense to me.

Let me show an example of what I’m refering to.

server = TCPServer.new(“0.0.0.0”,“8888”)
session = server.accept
while(out = session.gets) ## <–if I don’t call gets' on session puts out ## I can't callsession.print’ below
end

##if you call gets' above then the following lines will execute ##if you don't call gets above, thensession.print’ fails --why?

session.print "HTTP:/1.1 200 OK/OK\r\nContent-type: text/html\r\n\r\n"
session.print “

#{Time.now}

\r\n”

NOTICE: This e-mail and any attachment(s) may contain confidential and
proprietary information of Goss International Corporation and/or its
subsidiaries and may be legally privileged. This e-mail is intended solely
for the addressee. If you are not the addressee, dissemination, copying or
other use of this e-mail or any of its content is strictly prohibited and
may be unlawful. If you are not the intended recipient please inform the
sender immediately and destroy the e-mail and any copies. All liability for
viruses is excluded to the fullest extent permitted by law. Any views
expressed in this message are those of the individual sender. No contract
may be construed by this e-mail.