5 years ago.

TCPSocket usage questions

Hi there,

I'm hoping someone can clarify something or explain why it's not needed. I'm trying to get my head round socket programming and have a few questions. My use case is to have a server listening on a port for a single connection which sends commands and receives responses. So I have no need for multiple connections, just be robust in respect to the network going down.

If I've got a TCPSocket that I've opened, bound and called listen on, once I've accepted a new connection, how do I get the status of the parent socket? I've been trying to adapt the example at the bottom of the the following page and use a similar method with an event handler for sigio(): https://os.mbed.com/docs/mbed-os/v5.11/apis/network-socket.html

However, I can't find any documentation or examples for polling or responding to state changes on the parent socket. Perhaps it never does anything aside from create children?

Thanks.

This question has been expanded on a forum post but an example of what I'm trying to do is here: https://os.mbed.com/users/sjalloq/code/tcp-socket-server/

The forum post with me getting nowhere fast is here: https://os.mbed.com/forum/mbed/topic/35452

posted by Shareef Jalloq 07 Apr 2019
Be the first to answer this question.