Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: A Simple Socket Server Using 'inetd'

by Anonymous Monk
on Aug 17, 2007 at 06:23 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-16 11:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found