From: "ara.t.howard" Date: 2007-10-14T10:01:28+09:00 Subject: Re: write_noblock is blocking? On Oct 13, 2007, at 6:31 PM, 7stud -- wrote: > Eric Hodel wrote: >> On Oct 13, 2007, at 15:20 , 7stud -- wrote: >>> Christoffer Lern� wrote: >>>> Anyone know what's up with TCPSocket#write_noblock >>> >>> The method hasn't been invented yet? >> >> That's rather harsh for a one letter typo. >> > > Harsh? In what way? responding that way when you didn't know > > I wasn't aware there was a similarly named method. I looked in the > index of pickaxe2, and there was no write_noblock method listed, > and now > that I look again there is no write_nonblock method listed either. I > also checked the standard library documentation for BasicSocket, > Socket, > and TCPSocket, and there was no write_noblock method listed, and now > that I look again, there is no write_nonblock method either. In fact, > there is no method that starts with 'write'. I also searched > google and > came up with 0 hits for write_noblock, which has to be a first for me. > searching != knowing besides, google pulls 'ruby write_noblock' up on the first hit http://www.google.com/search?q=ruby +noblock&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en- US:official&client=firefox-a > Of course, because the ruby documentation is so deplorable, maybe I > should have just assumed it was a commonly used method. > now you are being harsh again. cfp:~ > PAGER=cat ri IO|grep non pos, pos=, print, printf, putc, puts, read, read_nonblock, write_nonblock cfp:~ > PAGER=cat ri IO -------------------------------------------------------------- Class: IO Class +IO+ is the basis for all input and output in Ruby. An I/O stream may be _duplexed_ (that is, bidirectional), and so may use more than one native operating system stream. Many of the examples in this section use class +File+, the only standard subclass of +IO+. The two classes are closely associated. As used in this section, _portname_ may take any of the following forms. * A plain string represents a filename suitable for the underlying operating system. * A string starting with ``+|+'' indicates a subprocess. The remainder of the string following the ``+|+'' is invoked as a process with appropriate input/output channels connected to it. * A string equal to ``+|-+'' will create another Ruby instance as a subprocess. Ruby will convert pathnames between different operating system conventions if possible. For instance, on a Windows system the filename ``+/gumby/ruby/test.rb+'' will be opened as ``+\gumby\ruby\test.rb+''. When specifying a Windows-style filename in a Ruby string, remember to escape the backslashes: "c:\gumby\ruby\test.rb" Our examples here will use the Unix-style forward slashes; +File::SEPARATOR+ can be used to get the platform-specific separator character. I/O ports may be opened in any one of several different modes, which are shown in this section as _mode_. The mode may either be a Fixnum or a String. If numeric, it should be one of the operating system specific constants (O_RDONLY, O_WRONLY, O_RDWR, O_APPEND and so on). See man open(2) for more information. If the mode is given as a String, it must be one of the values listed in the following table. Mode | Meaning -----+-------------------------------------------------------- "r" | Read-only, starts at beginning of file (default mode). -----+-------------------------------------------------------- "r+" | Read-write, starts at beginning of file. -----+-------------------------------------------------------- "w" | Write-only, truncates existing file | to zero length or creates a new file for writing. -----+-------------------------------------------------------- "w+" | Read-write, truncates existing file to zero length | or creates a new file for reading and writing. -----+-------------------------------------------------------- "a" | Write-only, starts at end of file if file exists, | otherwise creates a new file for writing. -----+-------------------------------------------------------- "a+" | Read-write, starts at end of file if file exists, | otherwise creates a new file for reading and | writing. -----+-------------------------------------------------------- "b" | (DOS/Windows only) Binary file mode (may appear with | any of the key letters listed above). The global constant ARGF (also accessible as $<) provides an IO-like stream which allows access to all files mentioned on the command line (or STDIN if no files are mentioned). ARGF provides the methods +#path+ and +#filename+ to access the name of the file currently being read. ------------------------------------------------------------------------ Includes: --------- Enumerable(all?, any?, collect, detect, each_cons, each_slice, each_with_index, entries, enum_cons, enum_slice, enum_with_index, find, find_all, grep, group_by, include?, include_any?, index_by, inject, injecting, map, max, member?, min, partition, reject, select, sort, sort_by, sum, to_a, to_json, to_set, zip), File::Constants() Constants: ---------- SEEK_CUR: INT2FIX(SEEK_CUR) SEEK_END: INT2FIX(SEEK_END) SEEK_SET: INT2FIX(SEEK_SET) Class methods: -------------- for_fd, foreach, new, open, pipe, popen, read, readlines, select, sysopen Instance methods: ----------------- <<, binmode, block_scanf, close, close_read, close_write, closed?, each, each_byte, each_line, eof, eof?, fcntl, fileno, flush, fsync, getc, gets, inspect, ioctl, isatty, lineno, lineno=, open, pid, pos, pos=, print, printf, putc, puts, read, read_nonblock, readbytes, readchar, readline, readlines, readpartial, reopen, rewind, scanf, seek, soak_up_spaces, stat, sync, sync=, sysread, sysseek, syswrite, tell, to_i, to_io, tty?, ungetc, write, write_nonblock i know ruby-core is *always* looking for people to contribute for docs. you certainly get what you pay for with bloody open source eh? a @ http://codeforpeople.com/ -- it is not enough to be compassionate. you must act. h.h. the 14th dalai lama