From: Eric Hodel Date: 2006-03-24T10:52:18+09:00 Subject: [ANN] socket_accept_filter = socket_accept_filter Rubyforge Project: http://rubyforge.org/projects/rctools/ Documentation: http://dev.robotcoop.com/Libraries/socket_accept_filter == About Socket#set_accept_filter allows you to enable accept filters on server sockets. In FreeBSD accept filters allow you to delay the return from an accept () call until enough data arrives on the connection for processing avoiding extra context switches while waiting for the missing data. Consult the accf_data(9), accf_http(9) and accept_filter(9) man pages for further details. == Installing socket_accept_filter Run FreeBSD (or any BSD, I think). Then install the gem: $ sudo gem install socket_accept_filter == Using socket_accept_filter === Regular sockets require 'rubygems' require 'socket' require 'socket_accept_filter' server = TCPServer.new host, port server.set_accept_filter 'dataready' Then use the server socket as you would ordinarily. === WEBrick require 'rubygems' require 'socket' require 'socket_accept_filter' require 'webrick' class MyServer < WEBrick::HTTPServer def listen(*args) super @listeners.each do |server| server.set_accept_filter 'httpready' end end end Then use MyServer where you would ordinarily use WEBrick::HTTPServer. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com