|
-
Sep 15th, 2004, 01:48 PM
#1
Thread Starter
PowerPoster
UDP Winsock
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?
Last edited by Pino; Sep 21st, 2004 at 04:12 AM.
-
Sep 16th, 2004, 01:38 PM
#2
Re: UDP Winsock
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
-
Sep 22nd, 2004, 09:33 PM
#3
Re: Re: UDP Winsock
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 ?
-
Sep 23rd, 2004, 11:46 AM
#4
Re: Re: Re: UDP Winsock
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 ) 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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|