Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Aug 1996 14:08:26 -0000 ()
From:      "Jon T. Ilko" <>
Subject:   Creating an inetd server.
Message-ID:  <>

Next in thread | Raw E-Mail | Index | Archive | Help
  I'm trying to create a simple server that
will run from inetd on port 1211.  I added
   server  1211/tcp
to /etc/services and
   server stream  tcp  nowait  root /usr/tmp/server server
to /etc/inetd.conf.  I sent a Kill -HUP to inetd.
This is to code so far for the server:

  int sock, port;
  struct sockaddr_in server; 

  port = 1211;
  sock = socket(AF_INET, SOCK_STREAM, 0);
  if (sock < 0) 
      perror("opening stream socket");

  server.sin_family = AF_INET;
  server.sin_addr.s_addr = htonl(INADDR_ANY);
  server.sin_port = htons(port);
  if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&port, sizeof(port)))

  if (bind(sock, (struct sockaddr *) &server, sizeof(server))) 
      perror("binding stream socket"); 
  This compiles with no errors and runs if I remove the
lines I added to /etc/services and /etc/inetd.conf.
With the lines added to /etc/service and /etc/inetd.conf,
the server gives the error:
binding stream socket: Address already in use

Could Someone help me out and tell me what I'm doing wrong?
Online Computer Library Center
E-Mail: Jon T. Ilko  <>
Date: 08/22/96
Time: 14:18:50

This message was sent by XF-Mail

Want to link to this message? Use this URL: <>