Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: A Simple Socket Server Using 'inetd'

by Anonymous Monk
on Aug 17, 2007 at 06:23 UTC ( #633233=note: print w/replies, xml ) Need Help??

in reply to A Simple Socket Server Using 'inetd'

Fantastic, very nice approach. Just one question. How can you find out the client's ip address / port using this approach?
  • Comment on Re: A Simple Socket Server Using 'inetd'

Replies are listed 'Best First'.
Re^2: A Simple Socket Server Using 'inetd'
by samizdat (Vicar) on Aug 21, 2007 at 13:15 UTC
    You can't, directly, of course. With netstat and arp you could figure it out, although the connection is transient.

    Don Wilde
    "There's more than one level to any answer."
      Hey guys, Is it possible to get a sample of your SECSII client? I'd like to make a SECSII communication over TCP but seems to be difficult to me... Thanks a lot!
        I was working for Sandia Labs at the time, and under NDA. Sorry!

        It isn't that difficult, actually. It's just a simple binary protocol like any other, though there are some quirky things to it. :D

        Don Wilde
        "There's more than one level to any answer."
      I am trying it out on Windows, set up inetd via Cygwin and start it as Windows service. It always prompt "Bad file descriptor". at: my $line = <STDIN> When I connect via "telnet localhost <port>". Would you please shed some lights on it? Thanks,
Re^2: A Simple Socket Server Using 'inetd'
by Sarten X (Initiate) on Oct 15, 2008 at 20:50 UTC
    You can, though I'm not sure if there's any quirks to it (including how it behaves when not run from inetd)
    my $hersockaddr = getpeername(STDOUT); my ($port, $iaddr) = sockaddr_in($hersockaddr); my $ip = inet_ntoa($iaddr);
    That gives you $port and $ip nicely ready to use.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://633233]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2021-10-28 13:50 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (96 votes). Check out past polls.