|The stupid question is the question not asked|
my main goal was to show bidirectional communication was possible,
Bidirectional communication was never in question (by me).
My questions/concerns related to concurrent bidirectional comms (at the same endpoint), which AFAIK is impossible on any platform.
Of course, this never arises with the select loop mechanism, as there is only one thread of execution and it is either waiting; or processing a can_read state; or processing a can_write state; or an error state.
But with either a multi-threaded, or multi-process solution on multi-core hardware, it can be attempted -- as exampled by the idea that the client run one thread/process for doing the heartbeat and another for receiving the data -- and needs to be handled.
It can be handled (with threading at least), but unless the OP comes back and fills in a few of the blanks, there's probably little point in further pursuing the possibilities.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.