tags:

views:

208

answers:

1

I'm working on a socket app in Ruby Shoes, and want to send a message to the server. The server expects the XML message, and then a null (0) character.

How can I send that in TCP Sockets in Ruby?

Thanks.

+2  A: 

I found my own answer... The problem was not sending the NULL, it was a thread issue.

You can send a NULL as part of a string by just concatenating it on to the end of the string...

NULL = "\000"

... tc = tc + "</endtag>"

tc = tc + NULL

Socket.send(tc, 0)

RyanE