Hey guys,
I'm using AsyncUdpSocket to create a UDP connection between a client and server. I want to send a bunch of pictures from the server to the client. I have the client bound to a specific port, and the server has a socket which is connected to the client on that port. I have code to get the picture and send the data to the client:
where WRITE_TIMEOUT is defined as 5.0 and DATAGRAM as 1
When I try to send the datagram, it winds up calling the onUdpSocket:didNotSendDataWithTag:dueToError method. I have it telling me the error in a log message and I get this:
There was an error sending the datagram: Error Domain=NSPOSIXErrorDomain Code=40 UserInfo=0x20008c4e0 "Message too long"
All I'm trying to send as can be seen from above is the picture. I have my other code for doing a header commented out for now, I just want to send the picture. The picture is about 15kb large.
Any ideas what to do to fix this?
I'm using AsyncUdpSocket to create a UDP connection between a client and server. I want to send a bunch of pictures from the server to the client. I have the client bound to a specific port, and the server has a socket which is connected to the client on that port. I have code to get the picture and send the data to the client:
Code:
NSString *path = @"/path/to/picture";
NSData *picture = [[NSData alloc] initWithContentsOfFile:path];
NSLog(@"[picture length] = %ld", [picture length]);
[socket sendData:picture withTimeout:WRITE_TIMEOUT tag:DATAGRAM];
When I try to send the datagram, it winds up calling the onUdpSocket:didNotSendDataWithTag:dueToError method. I have it telling me the error in a log message and I get this:
There was an error sending the datagram: Error Domain=NSPOSIXErrorDomain Code=40 UserInfo=0x20008c4e0 "Message too long"
All I'm trying to send as can be seen from above is the picture. I have my other code for doing a header commented out for now, I just want to send the picture. The picture is about 15kb large.
Any ideas what to do to fix this?