Add support for read/write offsets.
It would be nice if read/write/send/recv/etc methods could accept an offset argument.
socket = Socket.new(...) buffer = String.b socket.read(1024, buffer) socket.read(1024, buffer, offset: buffer.bytesize)
The same for write, e.g.
socket = Socket.new(...) buffer = String.b amount = socket.write(buffer) socket.write(buffer, offset: amount)
Could also include "size:" so that we can selectively write parts of the buffer.
Updated by shyouhei (Shyouhei Urabe) about 2 years ago
I can imagine it is useful for TCPSocket#write to accept only a part of a buffer crafted by somebody else. But I cannot think of any actual use case when #read is useful with that extension. Do you have one?