Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Network: Listener/Detect Disconnect

    SDK Help
    0
    4
    420
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      On 29/01/2017 at 09:49, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   17-18 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hello,

      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?

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 16/02/2017 at 00:03, xxxxxxxx wrote:

          Hi,

          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.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 18/02/2017 at 03:03, xxxxxxxx wrote:

            No need to be sorry. Your answer serves me well! 🙂

            1 Reply Last reply Reply Quote 0
            • First post
              Last post