Local daemon socket
John Kennedy
warlock at csuchico.edu
Wed Mar 7 12:34:24 AEST 1990
I'm looking for a way to make a daemon executable on more than one machine.
Currently I'm using the following code:
.....
.
servsock = socket( AF_INET, SOCK_STREAM, 0 );
CHECK( servsock, SOCK_FAIL, "socket()" );
server.sin_family = AF_INET;
server.sin_addr.s_addr = htonl( INADDR_ANY );
server.sin_port = htons( (u_short) sockaddr );
length = sizeof( struct sockaddr_in );
result = bind( servsock, (struct sockaddr *) &server, length );
servsock = socket( AF_INET, SOCK_STREAM, 0 );
CHECK( result, SOCK_FAIL, "bind()" );
.
.....
If I only have one daemon running on the network, it's fine. If I have two
or more, they fail to bind the socket (Address already in use). I'd like to
limit the daemon so that other daemon's may be run on different host machines.
--
Warlock, AKA +----------------------------------------------------
John Kennedy | uucp: lampoon!warlock at csuchico.edu
CSCI Student | internet: warlock at csuchico.edu
CSU Chico +----------------------------------------------------
More information about the Comp.unix.wizards
mailing list