httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Taisuke Yamada <>
Subject Recommended way to handle UDP service?
Date Mon, 18 Dec 2006 10:25:13 GMT

I'm trying to implement UDP service (TFTP, etc) as an Apache module,
and would like to know official (= future compatible) way to
implement it.

After looking into 2.2.4-dev source, I came up with two different
implementations. Both works to some degree, with different drawbacks.

Type 1 implementation hooks into two very early stages to do it:
"create_server_config" and "command handler". By hooking in
early enough, I can assure UDP socket to exist in to-be-closed
"old_listeners", and revive it back to "ap_listeners" by calling
"ap_set_listener" explicitly (which is a handler for "Listen"
directive). This way, I can make UDP and TCP with the same port
number to coexist.

However, there's a drawback. In error_log file, I see lot's of

  (111)Connection refused: connect to listener on<udpport>

errors generated by "dummy_connection" (in mpm_common.c). Also, code
isn't clean enough because some key structures aren't ready yet at
this stage - I need to use static variables so I can do some fixup
work at later stage.

Type 2 implementation deals with the above by using "Listen <udpport>"
as a helper directive. By letting "Listen <udpport>" allocate a slot
in "ap_listeners" early enough, UDP initialization can be delayed
back to "open_log" stage.

But as a drawback, I end up with unwanted extra HTTP service running
on TCP port with the same port number as UDP.

For complete module implementation, I still need to find out how
can I do bucket handling, logging, etc. But before going further,
I decided it'd be safer to ask for a recommended way (or at least
a hint for it).

Can anyone advise me on this?
Thanks in advance.
Taisuke Yamada <>,
2268 E9A2 D4F9 014E F11D 1DF7 DCA3 83BC 78E5 CD3A

Message to my public address may not be handled in a timely manner.
For a direct contact, please use my private address on my namecard.

View raw message