This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to detect that the peer closed a TCP socket

Hello,

I am using the NCS v1.5.0, the nRF9160 SoC and the modem has firmware version mfw_nrf9160_1.2.3

Based on the UDP sample, I created an application that has opens a TCP listening server then waits for a client to connect. I am using blocking sockets and poll() to wait for events on the server and client sockets. My application is here tcp_listen.zip

It all works as expected, except that my application is not informed when the remote peer has closed the its end of the client socket.

Tracing with Wireshark on the remote peer side, I can see that when it closes the socket it sends a FIN+ACK packet. To which the nRF9160 modem sends an ACK. Nothing more happens. On the application, I expected that when the remote peer closes the client socket, the call to poll() would received a POLLIN, POLLHUP or POLLERR event. But nothing happens.

How can my application be informed that the remote peer has closed its end of the client socket ? 

Best regards,

  Nelson 

Parents
  • Hello Nelson,

    NelsonGoncalves said:
    In the attached Wireshark file, my PC (the client) has IP address 192.168.178.29 and the nRF9160 module (the server) has IP address 178.50.73.204. The Wireshark tracing test_nordic.pcapng

    Thanks a lot for your input!

    NelsonGoncalves said:
    Any updates ?

    Still no news from the development team. My very apologies for that! I will try to push on this one and come back to you.

    Regards,

    Markus

Reply
  • Hello Nelson,

    NelsonGoncalves said:
    In the attached Wireshark file, my PC (the client) has IP address 192.168.178.29 and the nRF9160 module (the server) has IP address 178.50.73.204. The Wireshark tracing test_nordic.pcapng

    Thanks a lot for your input!

    NelsonGoncalves said:
    Any updates ?

    Still no news from the development team. My very apologies for that! I will try to push on this one and come back to you.

    Regards,

    Markus

Children
No Data
Related