Jump to content
  • Advertisement
Sign in to follow this  
brandonman

Sending Integers with Winsock

This topic is 3661 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

Hey, I'm once again back to the multiplayer forums. I'm hoping to make a small MUD as my next project after I release my current one. I've gotten the basics of Winsock down with Mud Pies part one. I have decided I am going to go out on my own making the FSM, etc instead of copying-pasting the stuff from Mud Pies 2. One main question I have: Is it possible to send int's with Winsock? Thanks, and maybe expect some more questions after this.

Share this post


Link to post
Share on other sites
Advertisement


What language is it in (since you mention Winsock I assume its a real language and not some engine scripting language...)


In C/C++ you can copy memory into the packet buffer. The memory could be a STRUCT which can contain any data you want. You could cast a pointer to an INT or array of INT as pointer to void and use it to copy mem (there could be a problem if the plaforms on each end have a big endian/little endian difference).


I have pushed integers as strings in Visual Basic thru a TCP pipe -- using fixed format of digits (usually when needing 1 2 3 digits for message values

Share this post


Link to post
Share on other sites
You can send any binary data that you can memcpy(). The sendto() and send() functions are very similar to write() and memcpy() in how they handle the data you pass to it.

However, if you want your MUD to be accessed by a telnet client, then you cannot send binary data, because telnet clients expect the telnet protocol, which is plain text plus some control sequences to negotiate the connection.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!