Archived

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

Basiror

TCP/IP question

Recommended Posts

hello i am creating a little MFC based game and i wonder how i should handle the network stuff i have around 30 bytes i need to send to the server and a comfirmation that he received it should i create a connection and keep it up or recreate a connection everytime i want to send something?

Share this post


Link to post
Share on other sites
How frequently do you need to send the data? once on program start up (say) ? or every frame perhaps ? or is it so that you can have some kind of world-wide score board for example?

Share this post


Link to post
Share on other sites
for example when the user decides to build something
or when he sends some units to a planets ....

that doesn t happen all the time maybe every 20 seconds if you are an average player

Share this post


Link to post
Share on other sites
you should keep the connection

who knows, you may even want to send more data than that eventually

besides, tearing down and creating a connection takes a while (especially if you''re on a slow connection or the route between you and the server is slow)

Share this post


Link to post
Share on other sites
Depends on the computer (mainly, how much RAM) and what method you are using to read/write to the sockets... 1000 using blocking sockets? No... 1000 using select()? I wouldn''t recommend it... 1000 using asynchronous methods like events or callbacks? If it''s dedicated to being a server and doesn''t do any rendering, maybe, if it doesn''t have to think about too much...

1000 is a lot of sockets for a game, what do you need that many for?

Share this post


Link to post
Share on other sites
maybe you know these massive multiplayer games
with 1000s of players

i have a dedicated server and a client application

the client logs in an receives the latest state of his planets(it s a space game)

now he can build things .. buy sending the server a message that he builds this and that

thats why i wonder how to do it

i will add a timeout when the client doesn t browse through the menu for more than 2 minutes

is there another way where i set the server to receiving any data he gets on one port

and when the client logs in the client gets an auth code which he sends with his latest data to the server
so i don t have to keep up a connection but send my game data from the client

?




Share this post


Link to post
Share on other sites