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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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)