Results 1 to 4 of 4

Thread: UDP Winsock

  1. #1

    Thread Starter
    Super Moderator
    Join Date
    Dec 2003
    Posts
    4,787

    Resolved 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.

  2. #2
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,448

    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
    "Feel the force...read the source..."
    Utilities: POPFile DebugView Process Explorer Wireshark KeePass UltraVNC Pic2Ascii
    .Net tools & open source: DotNetNuke log4Net CLRProfiler
    My open source projects: Thales Simulator EFT Calculator System Info Reporter VSS2SVN IBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  3. #3
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,794

    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 ?

  4. #4
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,448

    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
    "Feel the force...read the source..."
    Utilities: POPFile DebugView Process Explorer Wireshark KeePass UltraVNC Pic2Ascii
    .Net tools & open source: DotNetNuke log4Net CLRProfiler
    My open source projects: Thales Simulator EFT Calculator System Info Reporter VSS2SVN IBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width