AsyncUdpSocket how to use receive

前端 未结 4 1908
甜味超标
甜味超标 2021-01-04 18:23

I am trying to get a program for iPhone running on the simulator. My problem is with receiving UDP data. I use asyncUdpSocket. If I make a socket and use sendData:(NSD

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-04 18:46

    I'm not familiar with this library but looking at the sample code from their Google Code Project reveals a few things.

    First of, I don't see any mention of this callback you describe. Looks like you're supposed to implement:

    - (void)onSocket:(AsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
    

    Also in the example the server is started with the following line:

    [listenSocket acceptOnPort:port error:&error]
    

    Here's a link to the sample code.

提交回复
热议问题