From owner-freebsd-hackers Tue Oct 29 05:26:21 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id FAA27725 for hackers-outgoing; Tue, 29 Oct 1996 05:26:21 -0800 (PST) Received: from po2.glue.umd.edu (po2.glue.umd.edu [129.2.128.45]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id FAA27720 for ; Tue, 29 Oct 1996 05:26:19 -0800 (PST) Received: from skipper.eng.umd.edu (skipper.eng.umd.edu [129.2.103.24]) by po2.glue.umd.edu (8.8.2/8.7.3) with ESMTP id IAA02825; Tue, 29 Oct 1996 08:26:16 -0500 (EST) Received: from localhost (chuckr@localhost) by skipper.eng.umd.edu (8.7.5/8.7.3) with SMTP id IAA18397; Tue, 29 Oct 1996 08:26:15 -0500 (EST) X-Authentication-Warning: skipper.eng.umd.edu: chuckr owned process doing -bs Date: Tue, 29 Oct 1996 08:26:15 -0500 (EST) From: Chuck Robey X-Sender: chuckr@skipper.eng.umd.edu To: Per Hojmark cc: hackers@freebsd.org Subject: Re: sockets programming question In-Reply-To: <199610290018.QAA21190@mustang.via.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Mon, 28 Oct 1996, Per Hojmark wrote: > > I want to build a database server process that: > - listens on a port > - connects to incoming users > - forks to create new state & connection info for database. > - does some database lookups > - returns info to user > - closes connection. > > So, suppose I was listening on port 1234, when I get a connection > from a remote machine, do I need to switch to a new port number? > > I notice that many programs use 'well known' port numbers, but after > forking, seem to switch to a port > 1024. It appears that they use > the 'well-known' port number just for the initial connection. I'd like to suggest you go and buy a book that I think a lot of, Unix Network Programming by W. Richard Stevens, where he gives complete examples of programs doing exactly what you're describing. It'll be well worth your money, believe me. > > -per > ----------------------------+----------------------------------------------- Chuck Robey | Interests include any kind of voice or data chuckr@eng.umd.edu | communications topic, C programming, and Unix. 9120 Edmonston Ct #302 | Greenbelt, MD 20770 | I run Journey2 and n3lxx, both FreeBSD (301) 220-2114 | version 2.2 current -- and great FUN! ----------------------------+-----------------------------------------------