On Wed, Sep 25, 2013 at 05:57:49PM +0900, Ashwini Sharma wrote: > Hi Rob, list, > > Attached is the implementation of tcpsvd and udpsvd. > Both the commands are handled in the same file and support __IPv4__ and > __IPv6__. > > Let me know for any comments and add it to the hg. > > regards, > Ashwini
> /* tcpsvd.c - TCP(UDP)/IP service daemon > * > * Copyright 2013 Ashwini Kumar <[email protected]> > * Copyright 2013 Sandeep Sharma <[email protected]> > * Copyright 2013 Kyungwan Han <[email protected]> > * > * No Standard. > > USE_TCPSVD(NEWTOY(tcpsvd, "^<3c#=30<1C:b#=20<0u:l:hEv", > TOYFLAG_USR|TOYFLAG_BIN)) > USE_TCPSVD(OLDTOY(udpsvd, tcpsvd, OPTSTR_tcpsvd, TOYFLAG_USR|TOYFLAG_BIN)) > > config TCPSVD > bool "tcpsvd" > default y > help > usage: tcpsvd [-hEv] [-c N] [-C N[:MSG]] [-b N] [-u User] [-l Name] IP > Port Prog > udpsvd [-hEv] [-c N] [-u User] [-l Name] IP Port Prog > > Create TCP/UDP socket, bind to IP:PORT and listen for incoming > connection. > Run PROG for each connection. > Out of curiousity, what does this do that the netcat "server options" can't do? Ah. Change user after bind, provide a limited number >1 of connections, and set environment variables. And I see that the command is from ipsvd, not homegrown. Now, the second question...could any of this be shared with netcat? > IP IP to listen on, 0 = all > PORT Port to listen on > PROG ARGS Program to run > -l NAME Local hostname (else looks up local hostname in DNS) > -u USER[:GRP] Change to user/group after bind > -c N Handle up to N (> 0) connections simultaneously > -b N (TCP Only) Allow a backlog of approximately N TCP SYNs > -C N[:MSG] (TCP Only) Allow only up to N (> 0) connections from the > same IP > New connections from this IP address are closed > immediately. MSG is written to the peer before close > -h Look up peer's hostname > -E Don't set up environment variables > -v Verbose > */ On a cursory inspection, it doesn't look bad, though I have a suspicion it could be more concise. Thanks, Isaac Dunham _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
