1
votes

Hello i've stumbled on a strange problem on IOS 8.0.2

My app uses posix api to create tcp socket connect to the server, and send some data over it. At the and close() is called with the socket handle and the program terminates. I've remarked that the TCP FIN packet is sent to the server only after the program is exited. To overcome this problem i have to use shutdown() call on the socket. Any ideas why this happens? Maybe because the socket created in one thread and closed in another one?

1
Did u get this issue fixed or solution for this? - Ashok
The only way this can happen is if the FD has been inherited by another process and one of the two processes is still running. - user207421

1 Answers

-1
votes

You have to use shutdown to initiate the FIN sequence. Please note, the shutdown only gives a command to the kernel to start the sequence which goes further asynchronously to the process invoked shutdown. The close call only releases the socket's resources.