[TriLUG] TCP socket connections in Linux, gathering data from embedded device - - was WGET-LYNX??

Timothy A. Chagnon tchagnon at futeki.net
Fri Sep 24 20:06:48 EDT 2004


On Fri, 2004-09-24 at 18:19, Michael Thompson wrote:
> Any urls/snippets of this process would be very interesting to me, and
> I'm sure the rest of the list as well!  :)

There's not a lot of info about writing your own xinetd services because
they're just normal programs that read/write from standard in and
standard out.  You just need to make a file for your program in
/etc/xinetd.d specifying the xinetd options for it, like tcp/udp, socket
or datagram.  The xinetd.conf(5) man page will help with this.

You can even do something silly like make cat a service.  I made a file
called /etc/xinetd.d/cat with this in it:

# default: off
# description: reprints input with line numbers
service cat
{
        disable = no
        socket_type = stream
        protocol = tcp
        wait = no
        user = someuser
        server = /bin/cat
        server_args = -n
}

Also had to add this to the bottom of /etc/services to specify the port:

cat             31400/tcp

Then restart xinetd and do a
$ telnet localhost 31400

shows runs cat and numbers your lines of input.  This isn't really
useful, just an example. Note you have to manually break your telnet
session with Ctrl+] for this example.

There are plenty of pages about configuring options for xinetd.  Check
out xinetd.org or search at tldp.org.

-Tim
-- 
Timothy A. Chagnon <tchagnon at futeki.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.trilug.org/pipermail/trilug/attachments/20040924/882d4c99/attachment.pgp>


More information about the TriLUG mailing list