inetd confusion



I am trying to implement a simple daemon that sits behind inetd.

It is fed a single string of chars, spits back an answer, and then exits.

The inted.conf line reads:

502 stream tcp wait /bin/mbtcpgw mbtcpgw

If I understand this correctly, inetd should only allow a single connection to port 502 at a time. It should also close the connection (generate an EOF?) when the client disconnects.

My daemon is using fgets(buffer, 512, stdin) to read the string.

I am seeing two problems:

1. When I connect and disconnect, the daemon never sees a EOF, so it hangs, and never exits.

2. Inetd is not issuing any 'connection refused' messages; AFAICT it still allows new connections to port 502, but doesn't start any new instances of mbtcpgw.

Before I go reinventing the wheel, is my understanding of inetd function faulty?

--Yan
.



Relevant Pages

  • Re: need a linux script
    ... what Jan's saying is that the problem is definitely with inetd; ... In the old days, before inetd, each port that accepted incoming ... but each daemon had to run just in case somebody tried to ... entries in /etc/inetd.conf), starts it, and passes the connection on. ...
    (alt.os.linux.suse)
  • Re: ssh fails with xinetd
    ... I have a FreeBSD 6.2 system on which inetd was replaced with xinetd. ... spawned by inetd when there's a connection request. ... suffer serious abuse and unsuccessfully preserve the daemon. ...
    (comp.security.ssh)
  • Re: AUTH and sendmail
    ... > connection comes into access control database. ... > Qpopper 4.X has DRAC support, ... And the question about ip was not about access control but about general inetd ... I mean in which way inetd gives ip to daemon. ...
    (FreeBSD-Security)
  • Re: inetd vs standalone daemon
    ... With inetd, you can also turn regular filters into network ... Because the big daemon needs to find out which service ... would it forkthe configured program to handle the connection. ...
    (freebsd-questions)
  • Re: db2 - persistent connection
    ... > db2 tables. ... > Is some sort of middle daemon that ... > keeps one persistent connection to db2 and then have perl feed the ... stop during this in a bunch of small exits - put them in a ...
    (perl.dbi.users)