Jump to content
  • Advertisement
Sign in to follow this  
save yourself

building packets to send

This topic is 5408 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a setup in which there is a client (done in VB.net) connection to a main server (done in c++). A lot of the data that I need to send between the two are numbers between 0-255, so I just need one byte to represent each. Now instead of sending "123" which takes three characters, I can just send the byte value for 123. My question is, in VB.net, HOW can I turn this number into its single byte value and then add it to a string (or char array) to send over the network? The Chr and ChrW functions are a start... but I can only get those to work for 1-127. I believe after that it is trying to use a double byte character set which is NOT what I want. I also have a problem with 0 since it is the NULL terminator for a string... Any ideas on how I can convert 0-255 to a single byte then add it to the packet array?

Share this post


Link to post
Share on other sites
Advertisement
Sounds like you're looking for the Convert class:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemconvertclasstopic.asp


Ryan

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!