TCP/IP question

Started by
5 comments, last by Basiror 21 years, 3 months ago
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?
http://www.8ung.at/basiror/theironcross.html
Advertisement
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?
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
http://www.8ung.at/basiror/theironcross.html
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)
how many connections can i use that way?

more than 1000?
http://www.8ung.at/basiror/theironcross.html
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?
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

?




http://www.8ung.at/basiror/theironcross.html

This topic is closed to new replies.

Advertisement