From owner-freebsd-questions Tue Jun 10 18:41:10 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id SAA20214 for questions-outgoing; Tue, 10 Jun 1997 18:41:10 -0700 (PDT) Received: from cedb.dpcsys.com (ns2.BEACH.net [209.25.4.3]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id SAA20206 for ; Tue, 10 Jun 1997 18:41:05 -0700 (PDT) Received: from localhost (dan@localhost) by cedb.dpcsys.com (8.8.5/8.8.2) with SMTP id BAA13168; Wed, 11 Jun 1997 01:41:00 GMT Date: Tue, 10 Jun 1997 18:41:00 -0700 (PDT) From: Dan Busarow To: edward.ing@utoronto.ca cc: freebsd-questions@FreeBSD.ORG Subject: Re: User server daemons listening on SOCKETS? In-Reply-To: <339DF49E.5AC6@utoronto.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Tue, 10 Jun 1997 edward.ing@utoronto.ca wrote: > Is it possible to programme a server daemon that listens on a Socket > and then spawns a new connection process to provide the service to > run under a users environment rather than the root environment. As long as you bind to a port higher than 1024 there's no problem at all doing this. But, you should check with your provider first, if they see a strange service running in netstat -a your daemon could get killed pretty quick. > If I can, how can I write a routine to automatically determine which > ports are free so my server will not spawn a process which will uses a > port that another daemon on the host is using? Just look through /etc/services and pick an unused port. Pretty crude but with so many numbers available it seems to work. You could also pick a service no one uses and co-opt its port. dbbrowse 47557/tcp #Databeam Corporation dbbrowse 47557/udp #Databeam Corporation I've never heard of it :) Dan -- Dan Busarow 714 443 4172 DPC Systems / Beach.Net dan@dpcsys.com Dana Point, California 83 09 EF 59 E0 11 89 B4 8D 09 DB FD E1 DD 0C 82