Advertisement

Help with UDP's

Started by April 23, 2002 12:25 PM
2 comments, last by Marius 22 years, 9 months ago
I started with a tcp/ip stream connection (both ways). My game server was firing up a thread for each client. I have simulated a dumb client feeting up the server with 128 octets each 30 miliseconds 4k/sec. Now the server has to update back the others witch each of one actions, so the input at a given time for 3 clients was 12k the send was 3 times of 12 so the throwput increases dramatically with the number of clients. I got a 200 ms response time with 156 clients. Now I''ve changed the Server/Client, From Client to Server I use stream socket, and the server only broadcast on UDP the status. The response time decreased under 10 ms with 20 clients. In this case I have lost packets. Does anyone know how to manage a UDP lost packet. Has the server to send it again. How the server know''s about it. Thanks MCO
MCO
read 16 clients not 156

MCO
MCO
Advertisement
UDP packets aren''t guaranteed to arrive in order or necessarily at all. also, there really isn''t a way to tell if you''re missing one b/c it could come in a few more cycles. in general the typical set up is to only send information that isn''t mission critical over UDP. basically use UDP for date that doesn''t really matter if every single packet gets there.

if you care about the data actually gettting there you have to use TCP packets not UDP.

-me
Or implement your own guaranteed delivery system over UDP (which is what directplay does). For each of your message types, you need to decide wether it matters if the packet gets dropped (ie. for movement updates, if you drop a packet it doesn''t matter too much, because it won''t be long before another movement update packet arrives) or if it''s delivery must be guaranteed (for instance a packet telling your client you have been killed). It''s easiest to treat out-of-order packets as dropped packets for packets that don''t need to be guaranteed. As for implementing guaranteed packets, my first suggestion is to read about how TCP is implemented and use that as a base for idea''s. You may want to use some parts and not others, for instance you may wish to use a different throttle control than the sliding window, or you may wish to use some sort of request system, rather than acknowledgements when you think you may have dropepd a packet, etc.

This topic is closed to new replies.

Advertisement