Archived

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

CtrlAltDel

1 Packet instead of 10

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