httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject [PATCH] UDP support for unix
Date Sat, 20 Apr 2002 04:27:59 GMT

I'd like to submit this patch for UDP support to
unix versions of Apache 2.0

This patch adds UDP support to the
prefork MPM; however it should be
trivial to add UDP support to other MPMs (changing
definition in mpm.h, and adding the
UDP_LISTEN_COMMANDS line in the MPM source

Here's how it works:

1. At configuration time, there's a new directive
"UDPListen".  This is just
like the normal "Listen" directive, but it sets up
a UDP "listener".  It sits
in the httpd.conf file, and looks like this (where
"8021" is the port number):

UDPListen 8021

2. Since there's no notion of accept() on a UDP
socket, there's a new
abstraction layer between the accept system call,
named unixd_pop_socket.  If
the incoming request is UDP, the socket gets
routed to a UDP version of the
"unixd_accept" function.  If the request is TCP,
it gets send to the existing
"unixd_accept" function.
3. The network I/O is now done using recvfrom() &
sendmsg, since UDP must know
the port/address of the client.  Additionally,
rather than using sendfile() for
the UDP requests, emulate_sendfile is used
instead.  This is required since
sendfile() won't work with connection-less sockets.

That's pretty much it.

Although the UDP transport layer will work for
HTTP, for me the value of UDP
is to use Apache 2.0 with its new multiple
protocol support.  In this way,
I can write an Apache protocol module to
communicate with the legacy UDP
systems that I've got to support.

I've included a modified version of one of the APR
UDP test apps, and its
Makefile to exercise the server.

Tony Toyofuku
Ticketmaster Corp.

View raw message