Advertisement Jump to content

Archived

This topic is now archived and is closed to further replies.

CtrlAltDel

1 Packet instead of 10

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

strcpy(myBuf, "move_space"); nRet = send(theSocket, myBuf, strlen(myBuf), 0); if (nRet == SOCKET_ERROR) { printf("Error on send()"); return 0; } I call this packet 10 times without the data changing, depending on what the player does, however, this builds up packets since they are called rapidly. How can I remedy this?

Share this post


Link to post
Share on other sites
Advertisement
You write a class. "Flush" is a custom method that does what your function does currently; send the buffered data to the client. Then you write a custom "Send" method that just puts data into the buffer. Whenever you want to send data you call your custom Send function.

Then just call "Flush" every iteration (or fraction of a second) instead of everytime you need to send a message.

It''s like COUT. COUT actually puts the data into a buffer until it has time to output it or you use "flush" or "endl"

endl is flush with a "\n"

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Tiberian Merchandise!!!! | GameShot ]

Share this post


Link to post
Share on other sites

  • 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!