Reputation: 6853
This code doesn't send the trailing null byte. How do I send the trailing null?
Socket.writeUTFBytes('Hello World');
Socket.flush();
Thanks in advance. :)
Upvotes: 2
Views: 1695
Reputation: 1543
Have you tried:
Socket.writeUTFBytes('Hello World\0');
Socket.flush();
Upvotes: 0
Reputation: 74949
use writeByte
.
socket.writeUTFBytes('Hello World');
socket.writeByte(0);
socket.flush();
Upvotes: 5
Reputation: 14004
I'm not certain how to attach it to the end of a string literal. But you can always do:
Socket.writeByte(0);
Upvotes: 2