Date: Thu, 22 Aug 1996 14:08:26 -0000 () From: "Jon T. Ilko" <ilko@oclc.org> To: freebsd-questions@freebsd.org Subject: Creating an inetd server. Message-ID: <XFMail.960822142425.ilko@oclc.org>
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: 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 <ilko@oclc.org> Date: 08/22/96 Time: 14:18:50 This message was sent by XF-Mail ----------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.960822142425.ilko>