How do you send integer values via server sockets?
Sending strings is fairly easy since that is what is being covered in the MDN tutorials.
How do you send integer values via server sockets? Sending strings is fairly easy
Share
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.
You can convert it to a string, XML, or any other format you wish. Or, if you want to send just the bytes of the integer, you can convert the integer to a byte array like this:
However, if you do that, you must be careful of the byte-order on both ends of the communication (big endian vs. little endian).