Re: using perl for W3 servers
Marc VanHeyningen <mvanheyn@cs.indiana.edu>
From: Marc VanHeyningen <mvanheyn@cs.indiana.edu>
To: Putz.parc@xerox.com
Cc: www-talk@nxoc01.cern.ch
Subject: Re: using perl for W3 servers
In-reply-to: Your message of "Mon, 22 Mar 1993 11:25:56 PST."
<93Mar22.112603pst.58466@spoggles.parc.xerox.com>
Date: Mon, 22 Mar 1993 15:33:16 -0500
Message-id: <888.732832396@moose.cs.indiana.edu>
Sender: mvanheyn@cs.indiana.edu
Thus wrote:
>I have a couple of HTML servers written in perl, running
>under SunOS Unix, invoked via inetd.
>
>Is there a way in perl to find out the internet address of the client?
>Or do I have to give up the convenience of inetd to do that?
I have an HTTP server written in perl, under SunOS Unix, as a
standalone daemon without inetd. I considered inetd but am of the
opinion that the performance would be unacceptable if perl had to
parse the whole thing for every request. Forks are not that expensive
in perl, and probably will be faster once we convert to a OpSys with
copy-on-write. Thus, the code from mine looks more or less like the
code on page 345 of the Camel book. It's running; URL
http://cs.indiana.edu/ if you want to peek. I plan to release the
code once it's stable, though people can have unstable copies if they
really want.
The following code is taken from page 153 of the Camel book, and
probably does what you want:
$sockaddr = 'S n a4 x8';
$mysockaddr = getsockname(S);
($family, $port, $myaddr) = unpack($sockaddr, $mysockaddr);
- Marc
--
Marc VanHeyningen mvanheyn@cs.indiana.edu MIME & RIPEM accepted
De Gaulle remark[s ...] about the American "will to power, cloaking itself in
idealism." By now, this will to power is not so much cloaked in idealism as
it is drowned in fatuity. - Chomsky