开发者

system call ("send") on iPhone Socket

开发者 https://www.devze.com 2023-04-04 09:41 出处:网络
I\'m testing my iPhone application for the reaction after the Network Connection is gone. I\'m using \"send\" system call to send the packets over the TCP connection:

I'm testing my iPhone application for the reaction after the Network Connection is gone.

I'm using "send" system call to send the packets over the TCP connection:

ssize_t databytes = send(sockfd, buff, readed, 0);

The problem is that after the network is gone, my server stop receiving the packets and this system call ke开发者_Go百科ep returning that "could send" X amount of bytes for at least 2 minutes.

How can I fix this situation? I want to be sure that the packets arrived to the server.

Best!


Usually when you send information over a network you have to receive confirmation packets. You should do the same. From the server send back to the client the amount of data received and stop sending other data until you have the confirmation.

0

精彩评论

暂无评论...
验证码 换一张
取 消