Issue #15560 has been updated by ioquatix (Samuel Williams).


Also, rather than using a keyword argument, it could be a 3rd argument after buffer, since buffer must be supplied in order for this to work.

----------------------------------------
Feature #15560: Add support for read/write offsets.
https://bugs.ruby-lang.org/issues/15560#change-76525

* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 2.7
----------------------------------------
It would be nice if read/write/send/recv/etc methods could accept an offset argument.

e.g.

```
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.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>