Find the answer to your Linux question:
Results 1 to 3 of 3

Thread: xinetd Behavior

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    xinetd Behavior

    I'm new to xinetd, and I've been reading through the man pages and the FAQ.

    Suppose I have a server, foo, that runs on port 5555. I can make one connection to it at a time on that port. I want xinetd to fork new instances of foo so multiple clients can connect to it.

    Here's a configuration entry:

    service foo
    type = UNLISTED
    socket_type = stream
    protocol = tcp
    wait = no
    server = /home/user/bin/foo
    port = 5555

    1) How does xinetd fork a new instance of foo when a previous instance is already listening on port 5555? Wouldn't the new process fail to launch because port 5555 is already in use by the previous process?

    2) Suppose five clients connect simultaneously, and xinetd forks five instances of foo. When the clients disconnect, does xinetd leave all five instances running?



  2. #2
    inetd/xinetd manage all the network socket stuff and all the fork stuf.

    When he receive a cnx, duplicate the socket, fork and start the server given in the config file using standard I/O. So you don't need to bother about socket, fork, cleanup when socket close.... Just do your code using stdin and stdout

    Install xinetd (urpmi xinetd / yum install xinetd / ....)

    /root/ :
    while (true) do
    read test
    echo $test

    service test
    disable = no
    socket_type = stream
    protocol = tcp
    port = 1000
    wait = no
    user = root
    server = /bin/bash
    server_args = /root/

    /etc/services : add this line
    test 1000/tcp

    # service xinetd restart

    # telnet 1000

    should echo each line you type
    (use Ctrl-Alt-] to get the telnet menu and quit)

  3. #3

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts