| Class | SockIO |
| In: |
lib/network/sockio.rb
|
| Parent: | Object |
The SockIO class implements the low level interface for TCP sockets.
read_flush will kill the input buffer
# File lib/network/sockio.rb, line 63 def read_flush @inbuffer = "" end
read_urgent will receive urgent data from the socket.
# File lib/network/sockio.rb, line 72 def read_urgent @sock.recv(@bufsize, Socket::MSG_OOB) end
write will transmit a message to the socket
# File lib/network/sockio.rb, line 46 def write(msg) @outbuffer << msg n = @sock.send(@outbuffer, 0) # save unsent data for next call @outbuffer.slice!(0...n) @outbuffer.size == 0 rescue Exception @outbuffer = "" # Does it really matter? raise end
write_flush will kill the output buffer
# File lib/network/sockio.rb, line 58 def write_flush @outbuffer = "" end
write_urgent will write urgent data to the socket.
# File lib/network/sockio.rb, line 81 def write_urgent(msg) @sock.send(msg, Socket::MSG_OOB) end