Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Integrating a service with inetd: (7 Items)
   
Integrating a service with inetd  
We have several services (both TCP and UDP-based) that we would like to integrate with inetd so as to reduce the system 
load.  We have a TCP service that we would like to tightly control the number of incoming connection requests as well as
 the number of established connections, so it would seem like having the service be a "wait" service, where our app 
performs an accept() on the socket that inetd was listening on and then continue to listen()/accept() until the maximum 
number of connections are handled, and when the servers goes idle for a period of time, exiting to let inetd resume 
listening.  So far, so good.  However, the help pages for inetd.conf has the following statements:

"Stream servers are usually marked as nowait, but if a single server process is to handle multiple connections it may be
 marked as wait. The master socket is passed as fd 0 to the server, which then needs to accept the incoming connection. 
The server should eventually time out and exit when no more connections are active. The inetd daemon will continue to 
listen on the master socket for connections, so the server should not close it when it exits. The identd server is 
usually the only stream server marked as wait."

I don't know what "so the server should not close it (the master socket) when it exits" means.  All file descriptors of 
a process are closed when a process exits.

Any help understanding what's meant by this?

Thanks,

Gordon Molek
Zebra Technologies Corp.
Re: Integrating a service with inetd  
On Thu, Oct 09, 2008 at 02:58:05PM -0400, Gordon Molek wrote:
> We have several services (both TCP and UDP-based) that we would like to integrate with inetd so as to reduce the 
system load.  We have a TCP service that we would like to tightly control the number of incoming connection requests as 
well as the number of established connections, so it would seem like having the service be a "wait" service, where our 
app performs an accept() on the socket that inetd was listening on and then continue to listen()/accept() until the 
maximum number of connections are handled, and when the servers goes idle for a period of time, exiting to let inetd 
resume listening.  So far, so good.  However, the help pages for inetd.conf has the following statements:
> 
> "Stream servers are usually marked as nowait, but if a single server process is to handle multiple connections it may 
be marked as wait. The master socket is passed as fd 0 to the server, which then needs to accept the incoming connection
. The server should eventually time out and exit when no more connections are active. The inetd daemon will continue to 
listen on the master socket for connections, so the server should not close it when it exits. The identd server is 
usually the only stream server marked as wait."
> 
> I don't know what "so the server should not close it (the master socket) when it exits" means.  All file descriptors 
of a process are closed when a process exits.
> 
> Any help understanding what's meant by this?
> 

Yes, that line doesn't make much sense.  inetd doesn't close
it internally if it's marked as wait but it doesn't matter
what the spawned server does as it's closed on its behalf on
exit if it hasn't already done so.

-seanb
RE: Integrating a service with inetd  
I've created a PR to fix up the docs. Thanks for pointing out the
oddity.


Steve Reid (stever@qnx.com)
Technical Editor
QNX Software Systems 
 
Re: RE: Integrating a service with inetd  
Ok, thanks.  That helps with the documentation.

Now we get to the meat of the matter.  :-)

I've got inetd to correctly instantiate my server application, which listens and accepts a connection on file descriptor
 zero and I can transfer data to my application.  However, when my application goes idle and exits, inetd reports:

<pid> reaped, status 0xf
restored rawport, fd4

HOWEVER, my application is never re-invoked by inetd when a new connection attempt is made to rawport (port 9100).  So, 
it appears to work the first time, but not for subsequent connection attempts.

Thanks again,

Gordon Molek
RE: RE: Integrating a service with inetd  

Are you running the latest inetd?  Such an issue was fixed in rev 473.

-seanb

-----Original Message-----
From: Gordon Molek [mailto:community-noreply@qnx.com]
Sent: Tue 10/28/2008 12:21 PM
To: general-networking
Subject: Re: RE: Integrating a service with inetd
 
Ok, thanks.  That helps with the documentation.

Now we get to the meat of the matter.  :-)

I've got inetd to correctly instantiate my server application, which listens and accepts a connection on file descriptor
 zero and I can transfer data to my application.  However, when my application goes idle and exits, inetd reports:

<pid> reaped, status 0xf
restored rawport, fd4

HOWEVER, my application is never re-invoked by inetd when a new connection attempt is made to rawport (port 9100).  So, 
it appears to work the first time, but not for subsequent connection attempts.

Thanks again,

Gordon Molek

_______________________________________________
General
http://community.qnx.com/sf/go/post15620


Attachment: Text winmail.dat 2.91 KB
Re: RE: RE: Integrating a service with inetd  
We are currently developing on Momentics 4.0.1.
RE: RE: RE: Integrating a service with inetd  
Are you using the inetd from the networking project?  If so make
sure it's up to date.

-sanb

-----Original Message-----
From: Gordon Molek [mailto:community-noreply@qnx.com]
Sent: Tue 10/28/2008 1:43 PM
To: general-networking
Subject: Re: RE: RE: Integrating a service with inetd
 
We are currently developing on Momentics 4.0.1.

_______________________________________________
General
http://community.qnx.com/sf/go/post15634


Attachment: Text winmail.dat 2.54 KB