eemceebee
eemceebee

Reputation: 2666

Problems receiving UPD Package with AsyncUdpSocket on Iphone SDK

I have a small app to test sockethandling on the iPhone and I use the AsyncSocket/AsyncUdpSocket lib.

Opening the socket and sending is not a problem but receiving is.

//Called when state is received
- (BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port
{
    NSLog(@"Incoming data");

    [sock receiveWithTimeout:-1 tag:0];
    return YES;
}

As I said, I do not get anything, but the question is, does the method only gets called when the upd package is complete ? How does the package needs to end? Zero Byte?

Thanks

Upvotes: 2

Views: 1204

Answers (1)

raliz
raliz

Reputation: 31

You should call the receive method (I think with a positive timeout) after sending out your packet. When the response is received the delegate method will be called and then you can process the received data.

-raliz

Upvotes: 1

Related Questions