From owner-freebsd-questions Thu Aug 22 11:24:44 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id LAA05518 for questions-outgoing; Thu, 22 Aug 1996 11:24:44 -0700 (PDT) Received: from fssun09.dev.oclc.org (fssun09.dev.oclc.org [132.174.19.10]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id LAA05513 for ; Thu, 22 Aug 1996 11:24:41 -0700 (PDT) Received: from dev1.NISDEV (dev1.dev.oclc.org) by fssun09.dev.oclc.org (4.1/SMI-4.1) id AA07020; Thu, 22 Aug 96 14:24:09 EDT Received: from pc40-203.dev.oclc.org by dev1.NISDEV (SMI-8.6/SMI-SVR4) id OAA18796; Thu, 22 Aug 1996 14:24:08 -0400 Message-Id: X-Mailer: XFMail 0.4 [p0] on FreeBSD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Mime-Version: 1.0 Date: Thu, 22 Aug 1996 14:08:26 -0000 () Organization: Online Computer Library Center From: "Jon T. Ilko" To: freebsd-questions@freebsd.org Subject: Creating an inetd server. Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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: main() { int sock, port; struct sockaddr_in server; port = 1211; sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) { perror("opening stream socket"); exit(1); } 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))) { perror("setsockopt"); exit(1); } if (bind(sock, (struct sockaddr *) &server, sizeof(server))) { perror("binding stream socket"); exit(1); } } 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? Thanks ---------------------------------- Online Computer Library Center E-Mail: Jon T. Ilko Date: 08/22/96 Time: 14:18:50 This message was sent by XF-Mail ----------------------------------