Module Kgio::SocketMethods
In: ext/kgio/accept.c  (CVS)

This method behaves like Kgio::PipeMethods, but contains optimizations for sockets on certain operating systems (e.g. GNU/Linux).

Methods

Included Modules

mWaiters

Attributes

kgio_addr  [RW]  Returns the client IP address of the socket as a string (e.g. "127.0.0.1" or "::1"). This is always the value of the Kgio::LOCALHOST constant for UNIX domain sockets.

Public Instance methods

     io.kgio_autopush = true
     io.kgio_autopush = false

Enables or disables autopush on any given Kgio::SocketMethods-capable IO object. This does NOT enable or disable TCP_NOPUSH/TCP_CORK right away, that must be done with IO.setsockopt

Only available on systems with TCP_CORK (Linux) or TCP_NOPUSH (FreeBSD, and maybe other *BSDs).

     io.kgio_autopush?  -> true or false

Returns the current autopush state of the Kgio::SocketMethods-enabled socket.

Only available on systems with TCP_CORK (Linux) or TCP_NOPUSH (FreeBSD, and maybe other *BSDs).

     socket.kgio_peek(maxlen)           ->  buffer
     socket.kgio_peek(maxlen, buffer)   ->  buffer

Like kgio_read, except it uses MSG_PEEK so it does not drain the socket buffer. A subsequent read of any type (including another peek) will return the same data.

This method may be optimized on some systems (e.g. GNU/Linux) to use MSG_DONTWAIT to avoid explicitly setting the O_NONBLOCK flag via fcntl. Otherwise this is the same as Kgio::PipeMethods#kgio_read

Same as Kgio::SocketMethods#kgio_read, except EOFError is raised on EOF without a backtrace

     socket.kgio_trypeek(maxlen)           ->  buffer
     socket.kgio_trypeek(maxlen, buffer)   ->  buffer

Like kgio_tryread, except it uses MSG_PEEK so it does not drain the socket buffer. A subsequent read of any type (including another peek) will return the same data.

This method may be optimized on some systems (e.g. GNU/Linux) to use MSG_DONTWAIT to avoid explicitly setting the O_NONBLOCK flag via fcntl. Otherwise this is the same as Kgio::PipeMethods#kgio_tryread

This method may be optimized on some systems (e.g. GNU/Linux) to use MSG_DONTWAIT to avoid explicitly setting the O_NONBLOCK flag via fcntl. Otherwise this is the same as Kgio::PipeMethods#kgio_trywrite

     io.kgio_trywritev(array)     -> nil, Array or :wait_writable

Returns nil if the write was completed in full.

Returns an Array of strings containing the unwritten portion if EAGAIN was encountered, but some portion was successfully written.

Returns :wait_writable if EAGAIN is encountered and nothing was written.

Note: it uses +Array()+ semantic for converting argument, so that it will succeed if you pass something else.

This method may be optimized on some systems (e.g. GNU/Linux) to use MSG_DONTWAIT to avoid explicitly setting the O_NONBLOCK flag via fcntl. Otherwise this is the same as Kgio::PipeMethods#kgio_write

     io.kgio_writev(array)        -> nil

Returns nil when the write completes.

This may block and call any method defined to kgio_wait_writable for the class.

Note: it uses +Array()+ semantic for converting argument, so that it will succeed if you pass something else.

[Validate]