Click to See Complete Forum and Search --> : UDP Winsock
Pino
Sep 15th, 2004, 02:48 PM
Ok after a year or so trying to create games with winsock tcp, someone said to me use UDP, from what i have started with, there is much less code, and can accept multiple users instantly am i correct? what are its main disadvantages?
ntg
Sep 16th, 2004, 02:38 PM
Originally posted by Pino
Ok after a year or so trying to create games with winsock tcp, someone said to me use UDP, from what i have started with, there is much less code, and can accept multiple users instantly am i correct? what are its main disadvantages?
Well, for one you don't have a way to know if a UDP packet was received from the intended recipient(s). Also, UDP packets may not arrive to their destination in the order they were transmitted.
For these reasons, applications using UDP must code functionality to recover from errors such as these...but the exact type of error-recovery mechanisms depend upon the application type. For example, if you're coding for a stock market and you want to notify certain brokers' terminals about a specific stock sale using UDP, then you need to find a way to guarantee delivery. If, on the other hand, you're coding for a game such as CounterStrike and some of the clients miss a UDP packet that contains info about a move of a game object, you usually ignore the problem and you expect the client to catch the next UDP packet and draw accordingly.
Usually, the most difficult part about UDP is knowing when to use it instead of TCP. As someone said, people that ignore the power of TCP are doomed to reinvent it. Gaming apps where high numbers of fps are needed are usually prime candidates for UDP. It uses much less resources than TCP and you can multicast/broadcast with it.
Cheers,
NTG
CVMichael
Sep 22nd, 2004, 10:33 PM
Originally posted by ntg
.... and you can multicast/broadcast with it.
Cheers,
NTG
I know you can broadcast with IP 255.255.255.255 over local network, don't think it works on the internet...
And how would you multicast ?
ntg
Sep 23rd, 2004, 12:46 PM
Originally posted by CVMichael
I know you can broadcast with IP 255.255.255.255 over local network, don't think it works on the internet...
And how would you multicast ?
Right, broadcast won't work on the internet (shouldn't anyway unless your ISP has gone over the deep end :eek2: ) and it's only useful if you want to send to a LAN.
To multicast you must make use of the functions needed to join/leave a multicast group. Haven't used it in .Net but I think it's supported.
Regards,
NTG
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.