home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!koonda.acci.com.au!ggr
- From: ggr@koonda.acci.com.au (Greg Rose)
- Subject: Re: perl socket filehandles
- Message-ID: <9224508.15763@mulga.cs.mu.OZ.AU>
- Sender: news@cs.mu.OZ.AU
- Organization: Australian Computing and Communications Institute
- References: <1992Aug31.181515.4294@colorado.edu>
- Date: Mon, 31 Aug 1992 22:41:14 GMT
- Lines: 28
-
- In article <1992Aug31.181515.4294@colorado.edu> dyker@locutus.colorado.edu (Barbara Dyker) writes:
- >I'm trying to write a program that will get started from
- >inetd. All I want to do is a getpeername on file descriptor
- >zero. How do I assign in perl a particular value to a socket
- >filehandle so I can do things like getpeername? I tried
- >doing simply
- > $mysockaddr = getpeername(0);
- >which gives me zip.
- >
- >Sockets are not really my thing so I could be missing something
- >fundamentally trivial. It seems that if I wanted to do a
- >getsockname I would have the same problem. In this
- >particular case I don't care much about my end. Anyone
- >have such a program I could use as an example?
-
- I tried to reply by e-mail but something went wrong, so anyway...
-
- The socket handling stuff from perl has been rewritten to use perl
- filehandles instead of file descriptors -- you are NOT directly
- calling the C library. So what you want is
-
- $mysockaddr = getpeername(STDIN);
-
- and it will work as expected.
-
- --
- Greg Rose Australian Computing and Communications Institute
- ggr@acci.com.au +61 3 282 2532
-