• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AsyncUdpSocket: Receiving duplicate UDP Packet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AsyncUdpSocket: Receiving duplicate UDP Packet


  • Subject: Re: AsyncUdpSocket: Receiving duplicate UDP Packet
  • From: Jens Alfke <email@hidden>
  • Date: Fri, 14 May 2010 10:10:37 -0700


On May 12, 2010, at 7:35 PM, Todd Burch wrote:

I'm early in development, and all I'm doing is receiving a UDP packet over a given port, and logging it to the console. However, for some reason my UDP packet (transmitted from other software) appears to be arriving twice!

The previous advice should solve the immediate problem. But be aware that your code needs to be able to handle duplicate packets, as well as dropped packets. Both are entirely possible due to the way IP routing works. That's why it's called the Unreliable Datagram Protocol :)


Both cases are fairly rare with modern networks, but they do happen, and if your protocol doesn't deal with them, the result will be intermittent and hard-to-reproduce failures.

The usual solution is to put a serial number in each packet. That way the recipient can detect if it receives the same serial number twice and ignore the second one. They're also useful for putting out-of- order packets back in order — that's a likely scenario if the packets are traveling a long distance since they might take different routes.

—Jens_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >AsyncUdpSocket: Receiving duplicate UDP Packet (From: Todd Burch <email@hidden>)

  • Prev by Date: Re: TUTORIAL: Generating Unique ID Strings
  • Next by Date: Re: [[NSFileManager alloc] init] considered thread-safe
  • Previous by thread: Re: AsyncUdpSocket: Receiving duplicate UDP Packet
  • Next by thread: Re: AsyncUdpSocket: Receiving duplicate UDP Packet
  • Index(es):
    • Date
    • Thread