SPUG: Closing HTTP::Daemon port

Andrew Sweger andrew at sweger.net
Wed Aug 13 04:10:19 CDT 2003


On Tue, 12 Aug 2003, Marc M. Adkins wrote:

> So...when I close the HTTP::Daemon object it isn't closing the listen port?
> I haven't taken the time to crawl through that code yet...

The listener is definitely closing cleanly. It's the connection handling
the "client" request that's not getting cleaned up. To see this in action,
fire up the first instance of the server, then run this in another
terminal:

for i in $(seq 1 10); do
  wget http://localhost:9876/foobar > /dev/null 2>&1
done
netstat -nape --inet
# Thanks, Adam!

The "/foobar" URI is just to exercise the server and not make it really do
anything other than return an error page. You should see ten sockets in
TIME_WAIT state with the local address being on port 9876. The "foreign"
addresses will all be on various ports. You should also see that there is
no process associated with these sockets. The listener should still be
there on port 9876 and associated with the daemon's PID. I believe this is
the same thing that happens when giving the /quit command. The listener
(essentially a "half" socket) is nowhere to be found after giving the
/quit command.

-- 
Andrew B. Sweger -- The great thing about multitasking is that several
                                things can go wrong at once.




More information about the spug-list mailing list