From: Nat Pryce Date: 2001-08-07T08:16:39+09:00 Subject: [ruby-talk:19259] ANNOUNCE: socket options library v0.1 I would like to announce the release of Sockopt 0.1. Sockopt is a package of pure Ruby code that extends Ruby's built in socket classes with convenient attributes and methods for setting common socket options. For example, rather than writing: require 'socket' ... socket = UDPSocket.new socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, [1].pack("i_") ) You can write: require 'socket' require 'sockopt' ... socket = UDPSocket.new socket.reuse_addr = bool The package includes the sockopt.rb file and unit tests for the RubyUnit framework. I have tested the code on Windows 2000 on an Intel x86 CPU. There may be compatibility issues with other operating systems or processor architectures with different word sizes or endianness. Please let me know if the tests pass or fail on other platforms. Even better than failure reports would be additional unit tests that fail with the current sockopt code and patches to sockopt.rb that cause the tests to pass. I have written this as a proof-of-concept for an RCR. What do people think about extending the Ruby socket classes with methods like this written in C? Sockopt is available from http://www.b13media.com/dev/ruby/index.html. Finally, thanks to Will Sobel for supplying me with example code for setting/getting socket options, which started me on my way with this small project. Cheers, Nat Pryce.