in reply to Re: Determinine Protocol In inetd.
in thread Determinine Protocol In inetd.

I mentioned this as a possibility. If I have to I will. But I would rather that the code could determine it on its own.

Even without passing parameters I could write a dummy script:
#!/usr/bin/perl exec "MyRealProg.pl --proto=udp"
Course, this would be a double exec.

Is there any way to do it (suppose I wasn't in inetd and I was passed some fileno's of sockets to connect to -- is there a way to determine?)

my @a=qw(random brilliant braindead); print $a[rand(@a)];

Replies are listed 'Best First'.
Re: Re: Re: Determinine Protocol In inetd.
by merlyn (Sage) on Apr 28, 2001 at 19:30 UTC
    Looks like getsockopt can be used with an SO_TYPE subcommand to get the type such as SOCK_STREAM. I don't have working code, but something along that line should be useful.

    -- Randal L. Schwartz, Perl hacker

Re: Re: Re: Determinine Protocol In inetd.
by dws (Chancellor) on Apr 29, 2001 at 08:48 UTC
    But I would rather that the code could determine it on its own.

    identd has the protocol in hand, yet you prefer to drop this knowledge on the floor and then rederive it downstream. Curiousity about how you might be able to derive the discarded prototype info is one thing, but from a pragmatic point of view, this is wasteful a approach.