GCDAsyncUdpSocket and maxReceiveSize

244 views
Skip to first unread message

AL1

unread,
Feb 2, 2012, 1:01:45 PM2/2/12
to CocoaAsyncSocket
Hello,

I am sending image to a multicast group using GCDAsyncUdpSocket. In
the GCDAsyncUdpSocket.m file, the default max4ReceiveSize is 9216. If
I change this to say 32768, it still can't receive any packet size
that is greater than 9216.

Anything else needed to be set in order to be able to receive packet
greater than 9216?

Thank you.

Robbie Hanson

unread,
Feb 3, 2012, 1:06:06 PM2/3/12
to cocoaasy...@googlegroups.com
Good question.

I believe what you're running into is SO_RCVBUF. This is the maximum size allowed by the socket within the kernel. You can try using setsockopt to increase this for your socket. So somthing like this:

[udpSocket performBlock:^{
int socketFD = [updSocket socketFD];
setsockopt(….);
}];

Also, do some googling for MTU, and MTU path discovery. If you're sending packets this big, they're likely getting fragmented as ethernet MTU may be 1500 bytes. Which may or may not be an issue.

-Robbie Hanson

> --
> You received this message because you are subscribed to the Google Groups "CocoaAsyncSocket" group.
> To post to this group, send email to cocoaasy...@googlegroups.com.
> To unsubscribe from this group, send email to cocoaasyncsock...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cocoaasyncsocket?hl=en.
>

AL1

unread,
Feb 4, 2012, 9:04:37 PM2/4/12
to CocoaAsyncSocket
It looked like MS Windows' default is around 9k as well. It seemed to
work well for all three OSes (iOS, Mac OS X and Windows) for what I am
trying to do.
Robbie, good job on the GCDAsyncUDPSocket. It allows me to quickly
implement what I am doing. Thank you for your info.

AL
Reply all
Reply to author
Forward
0 new messages