Skip to content

Commit

Permalink
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/main/java/org/jruby/ext/socket/RubyUDPSocket.java
Original file line number Diff line number Diff line change
@@ -276,7 +276,8 @@ public IRubyObject send(ThreadContext context, IRubyObject _mesg, IRubyObject _f
int written;

RubyString data = _mesg.convertToString();
ByteBuffer buf = ByteBuffer.wrap(data.getBytes());
ByteList dataBL = data.getByteList();
ByteBuffer buf = ByteBuffer.wrap(dataBL.unsafeBytes(), dataBL.begin(), dataBL.realSize());

written = ((DatagramChannel) this.getChannel()).write(buf);

@@ -321,7 +322,8 @@ public IRubyObject send(ThreadContext context, IRubyObject[] args) {

RubyString nameStr = _host.convertToString();
RubyString data = _mesg.convertToString();
ByteBuffer buf = ByteBuffer.wrap(data.getBytes());
ByteList dataBL = data.getByteList();
ByteBuffer buf = ByteBuffer.wrap(dataBL.unsafeBytes(), dataBL.begin(), dataBL.realSize());

byte[] buf2 = data.getBytes();
DatagramPacket sendDP;

0 comments on commit 2221210

Please sign in to comment.