Adding A Server Process To The Internet Daemon - HP Rp3440-4 - 9000 - 0 MB RAM Programmer's Manual

Bsd sockets interface programmer’s guide
Hide thumbs Also See for Rp3440-4 - 9000 - 0 MB RAM:
Table of Contents

Advertisement

Adding a Server Process to the Internet
Daemon
This section contains example BSD Sockets programs that use the
internet daemon, called inetd. For more information on inetd, refer to
the inetd(1M) man page.
You can invoke the example server programs from inetd if you have
super-user capabilities and you make the following configuration
modifications:
• Add the following lines to the /etc/inetd.conf file:
example
stream
tcp
example
dgram
• Add the following lines to the /etc/services file:
• If inetd is already running, execute the following command so that
These example programs do the same thing as the previous example
servers do, but they are designed to be called from inetd. They do not
have daemon loops or listen for incoming connection requests, because
inetd does that. The source code for the two example servers follows.
/*
/*
Chapter 8
nowait
root
<path>/server.tcp
udp
wait
root
where <path> is the path to the files on your host.
example 22375/tcp
example 22375/udp
inetd recognizes the changes:
/etc/inetd –c
*
*
*
This is a variation of the example program called serv.tcp.
*
This one performs the same function, except that it is
*
designed to be called from /etc/inetd. This version does
*
not contain a daemon loop, and does not listen for incoming
*
connections on the socket. /etc/inetd does these functions.
*
This server simply assumes that the socket to receive the
*
messages from and send the responses to is file descriptor
*
0 when the program is started.
*
the client connection is already established to the socket.
*
For the sake of simplicity, the activity logging
*
functions of serv.tcp have also been removed.
*
*/

Adding a Server Process to the Internet Daemon

server.tcp
<path>/server.udp
S E R V E R . T C P
It also assumes that
Programming Hints
server.udp
169

Advertisement

Table of Contents
loading

Table of Contents