views:

235

answers:

3

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. :)

+2  A: 

I'm not certain how to attach it to the end of a string literal. But you can always do:

Socket.writeByte(0);
CookieOfFortune
+3  A: 

use writeByte.

socket.writeUTFBytes('Hello World');
socket.writeByte(0);
socket.flush();
Sam
A: 

Have you tried:

Socket.writeUTFBytes('Hello World\0');
Socket.flush();
ablerman