CITS3002 Computer Networks  
prev
next CITS3002 help3002 CITS3002 schedule  

The Internet Supervisor Daemon - inetd

One problem with having many internetworking services supported, is that each operating system host requires many (idle) daemons just waiting for incoming connections on their reserved port - each consumes some memory and a process slot.

The common solution is a single 'super' daemon, listening for incoming connections on many ports. When a connection is made on, say, telnet's port (=23) the 'true' telnet daemon is invoked to service the connection.

The inetd daemon listens (accepts()) on many ports simultaneously (using select()), and then either handles the connection itself or spawns a new process.

inetd reads its configuration information from /etc/inetd.conf :

    telnet stream tcp nowait root   /usr/sbin/tcpd  in.telnetd
    #
    finger stream tcp nowait nobody /usr/sbin/tcpd  in.fingerd
    #
    ftp    stream tcp nowait root   /usr/sbin/tcpd  in.ftpd -l -a
    #
    time   stream tcp nowait root  internal
    time   dgram  udp wait   root  internal
    echo   stream tcp nowait root  internal
    echo   dgram  udp wait   root  internal

A conceptually similar multi-protocol server implementation in Java may be found in Flanagan's excellent Java Examples in a Nutshell, Chapter 5.

All code examples from this book are also available.


CITS3002 Computer Networks, Lecture 9, Client/server design, p11, 1st May 2024.