Joshua
Joshua

Reputation: 6853

Sending Character Zero "\0" Over Binary Socket In Flex

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

Answers (3)

ablerman
ablerman

Reputation: 1543

Have you tried:

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

Upvotes: 0

Samuel Neff
Samuel Neff

Reputation: 74949

use writeByte.

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

Upvotes: 5

CookieOfFortune
CookieOfFortune

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

Related Questions