[haiku-development] Re: How to Run a Program when a Network Port is Accessed?

  • From: "Alexander G. M. Smith" <agmsmith@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 11 Apr 2018 09:56:14 -0400 EDT

Jérôme Duval wrote on Tue, 10 Apr 2018 20:12:57 +0200:

You can modifiy the /system/settings/network/services file to add the port:

Thanks, that's just what I needed.

Also I finally found the under-the-hood code that waits for a
network access before it runs a service via OpenGrok in
servers/net/Services.cpp.  Seems to use the socket as standard
input/out/err for the launched program, didn't know that was the way
ftpd gets passed the open network connection.  Which implies I don't
need to tell ftpd which port to listen on for new connections, since
it isn't doing that.  It also means ftpd gets fired up for every new
connection, so you will have multiple copies running if several
people are using it at the same time.  But then ftpd in daemon mode
does that too, forking a copy of itself for each new connection.

- Alex

Other related posts: