• 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
UDP packets greater than 510 bytes clipped
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UDP packets greater than 510 bytes clipped


  • Subject: UDP packets greater than 510 bytes clipped
  • From: Heath Raftery <email@hidden>
  • Date: Tue, 21 Jun 2005 19:02:00 +1000

G'day list,

I've been playing with UDP transmission in my Cocoa app for a few days. My intention is to have UDP provide fast, unreliable, raw data transfer to back up the current TCP messaging framework I have working. At first sendto() returned EMSGSIZE's, so I now check getsockopt(SO_SNDBUF) first and limit outgoing packets to that size. I no longer get EMSGSIZE, and packet sniffing seems to show the correct thing happening. That is, the entire packet is sent out, but in IP fragments of about 1500 bytes. However the receiving host does not get all the data.

From what I've read, IP should fragment the packets to the MTU of the medium, and reassemble them at the other end. But the reassembly doesn't appear to be happening! In fact, on the receiving side I only get about 510 bytes of each packet, which destroys the data. On the advice I read in a few different places, I limited the packet size to 548 bytes, since apparently that guarantees I wont get segmentation. That didn't help - I still only received about 510 bytes.

In desperation I limited the packet size to 400 bytes, and everything seems to work well - except that I'm sending out a lot of packets of course!

The network architecture I was playing with was:
client <-> airport <-> server <-> localhost <-> client
SO_SNDBUF = 9216
SO_RCVBUF = 42080

I'm using the socket, bind and sendto calls to establish and send UDP data, and NSFileHandle's readInBackgroundAndNotify to read. Would I be right in discovering readToEndOfFileInBackgroundAndNotify does not apply to UDP?

Can anyone suggest why I can't get more than about 510 bytes through via UDP? Does anyone have any relevant resources to suggest to learn more about UDP on OS X using Cocoa? I've read a bit of general UDP information (such as <http://www.kmutt.ac.th/knowledge/programming/c/ unix_socket/faq/unix-socket-faq-5.html>) but haven't found much at all that deals with Cocoa or OS X in particular.

Heath
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: UDP packets greater than 510 bytes clipped
      • From: Douglas Davidson <email@hidden>
    • Re: UDP packets greater than 510 bytes clipped
      • From: Josh Graessley <email@hidden>
  • Prev by Date: Re: give a simple Thread mach-o projekt ??
  • Next by Date: attached gateways
  • Previous by thread: Re: give a simple Thread mach-o projekt ??
  • Next by thread: Re: UDP packets greater than 510 bytes clipped
  • Index(es):
    • Date
    • Thread