README: update URLs
[socket_dontwait.git] / README
blob0a91c4199e848ea696f60c20b8c850994f2c0f08
1 = socket_dontwait - socket methods using MSG_DONTWAIT and more
3 This library is a drop-in replacement that reimplements several IO
4 methods with replacements using MSG_DONTWAIT for BasicSocket.  This
5 allows us to avoid unnecessary system calls and GVL bouncing.
7 We've reimplemented the +readpartial+, +read_nonblock+,
8 +write_nonblock+, +read+ and +write+ instance methods normally inherited
9 from the IO class directly into BasicSocket with socket-specific system
10 calls and flags.
12 This library is only intended for Ruby 1.9.2+ and will not build with other
13 versions of Ruby.  This only supports operating systems with complete
14 support of the non-POSIX MSG_DONTWAIT flag for send(2) and recv(2)
15 syscalls on stream sockets.
17 This library is fully-supported and stable on GNU/Linux 2.6+.  It is
18 experimental and unsupported on other systems unless someone steps
19 forward to support them.  Some operating systems have incomplete/broken
20 support for the MSG_DONTWAIT flag on various types of stream sockets.
22 == Features
24 * Avoid use of fcntl(2) to set O_NONBLOCK in favor of MSG_DONTWAIT when
25   using non-blocking I/O.  We _unset_ O_NONBLOCK if we need to block
26   and release the GVL instead of relying on select(2).
28 * Avoids select(2) entirely in favor of blocking I/O when the
29   GVL is released.  This allows using file descriptor numbers higher
30   than 1023 without overflowing select(2) buffers or relying on malloc()
31   to allocate large fdsets.
33 * BasicSocket#read uses recv(2) with MSG_WAITALL to avoid extra system
34   calls for larger reads.
36 * Thread and signal-safe, releases the GVL for all blocking operations
37   and retries if system calls are interrupted.
39 == Bugs/Caveats
41 * We ignore taint/$SAFE checks, we'll support it if there's demand,
42   but we doubt there is...
44 * Ignores userspace read buffering in Ruby 1.9, relying on line-oriented
45   socket I/O is a good way to get DoS-ed.
47 * Does not support 1.9 encoding filters.  1.9 defaults all sockets to
48   Encoding::BINARY anyways, so this should not be noticeable to code
49   that leaves socket encodings untouched.
51 * Does not support write buffering in userspace.  Ruby defaults all
52   sockets to "IO#sync = true", anyways so this does not affect code
53   that leaves the default setting untouched.
55 == Install
57 If you're using a packaged Ruby distribution, make sure you have a C
58 compiler and the matching Ruby development libraries and headers.
59 You need Ruby 1.9.2+ to install socket_dontwait.  Previous versions of
60 Ruby will NOT be supported.
62 If you use RubyGems:
64     gem install socket_dontwait
66 Otherwise grab the latest tarball from:
68 http://bogomips.org/socket_dontwait/files/
70 Unpack it, and run "ruby setup.rb"
72 == Development
74 You can get the latest source via git from the following locations:
76   git://bogomips.org/socket_dontwait.git
77   git://repo.or.cz/socket_dontwait.git (mirror)
79 You may browse the code from the web and download the latest snapshot
80 tarballs here:
82 * http://bogomips.org/socket_dontwait.git (cgit)
83 * http://repo.or.cz/w/socket_dontwait.git (gitweb)
85 Inline patches (from "git format-patch") to the mailing list are
86 preferred because they allow code review and comments in the reply to
87 the patch.
89 We will adhere to mostly the same conventions for patch submissions as
90 git itself.  See the Documentation/SubmittingPatches document
91 distributed with git on on patch submission guidelines to follow.  Just
92 don't email the git mailing list or maintainer with socket_dontwait
93 patches.
95 == Contact/Bug Reports/Feedback/Patches/Pull-Requests
97 This was originally created for the Rainbows! project (but may be used by
98 others), so we'll reuse their mailing list at
99 {rainbows-talk@rubyforge.org}[mailto:rainbows-talk@rubyforge.org].