On 29/01/2017 at 09:49, xxxxxxxx wrote:
Cinema 4D Version: 17-18
Platform: Windows ;
Language(s) : C++ ;
I can't get my head wrapped around on how to detect a closed TCP connection that has been made via OpenWaitForIncoming / OpenListener.
Is there any chance to retrieve a connection's state?
It'd be possible to send custom bytes (ASCII chars) and filter them, but that does not work e.g. for terminals or other 3rd-party connections.
edit: Couldn't test yet, but will BytesInInputBuffer return 0 if the connection is not present?
On 30/01/2017 at 09:03, xxxxxxxx wrote:
I can now answer this question myself, although it's not that nice.
Seems there's no other way than continously sending bytes and then check what value SendBytes returns.
A return value of 0 means bytes could not be sent, ergo the connection has been closed.
If there's a more convenient way (like acting to TCP flags), please enlighten me.
Otherwise I suppose to use Winsock, which gives more flexibility.
On 16/02/2017 at 00:03, xxxxxxxx wrote:
I have to say this way to often lately: I'm terribly sorry for answering so lately.
I had to ask our development first, in order to not confuse anybody with my weak knowledge of network stacks.
Even if you already found out yourself, I can acknowledge that there is currently no native access to the underlying socket. While this might change at some point in future, for now you need to build it on your own. Sorry.
On 18/02/2017 at 03:03, xxxxxxxx wrote:
No need to be sorry. Your answer serves me well!