Hi, Many months ago I submitted a patch for UDP support within Apache 2.0. This a resubmission of that patch, which allows for UDP packets to work with Unix versions of Apache 2.0. Here's what I wrote then:
This patch adds UDP support to unix versions of Apache 2.0. This patch is set to add UDP support to the prefork MPM; however it should be trivial to add UDP support to other MPMs (changing the MPM_ACCEPT_FUNC definition in mpm.h, and adding the UDP_LISTEN_COMMANDS line in the MPM source code). 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. <<udp.patch>> <<httpd.conf>> <<readme.txt>> <<udpclient.tar.gz>> I've included a modified version of one of the APR UDP test apps, and its Makefile to exercise the server. Tony
udp.patch
Description: Binary data
httpd.conf
Description: Binary data
This patch adds UDP support to unix versions of Apache 2.0. This patch is set to add UDP support to the prefork MPM; however it should be trivial to add UDP support to other MPMs (changing the MPM_ACCEPT_FUNC definition in mpm.h, and adding the UDP_LISTEN_COMMANDS line in the MPM source code). 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.
udpclient.tar.gz
Description: Binary data