Set max buffer size to maximum allowed (#44)

* Set max buffer size to maximum allowed

I'm evaluating this library for an application that sends ~60kb size UDP messages. Without this setting the messages are cut off at the default message size.

This is probably something you'd want to set with `const socket = dgram.createSocket('udp4', { maxBufferSize: 'UINT16_MAX' })`. I've modified the library to automatically choose the largest allowed size `GCDAsyncUdpSocket` allows (which is 64kb).

* Set max ipv6 buffer size to uint16 maximum
This commit is contained in:
Marcus Stenbeck 2017-03-24 16:54:12 +01:00 committed by Mark Vayngrib
parent dc04cd35df
commit 69a8e844e3

View File

@ -93,6 +93,10 @@ NSString *const RCTUDPErrorDomain = @"RCTUDPErrorDomain";
_address = address;
_udpSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:[self methodQueue]];
[_udpSocket setMaxReceiveIPv4BufferSize:UINT16_MAX];
[_udpSocket setMaxReceiveIPv6BufferSize:UINT16_MAX];
BOOL result;
if (address) {
struct sockaddr_in ip;