Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jun 1997 18:41:00 -0700 (PDT)
From:      Dan Busarow <dan@dpcsys.com>
To:        edward.ing@utoronto.ca
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: User server daemons listening on SOCKETS?
Message-ID:  <Pine.UW2.3.95.970610183622.12932G-100000@cedb>
In-Reply-To: <339DF49E.5AC6@utoronto.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.UW2.3.95.970610183622.12932G-100000>