Understanding the Connection State Machine | Unity Transport | 0.3.1-preview.4
docs.unity3d.com
    Show / Hide Table of Contents

    Understanding the Connection State Machine

    It's important to at least understand how transitions occur in the connection state machine so you make decisions depending on what triggered each state. And to understand the subtle differences depending if you are Connecting to another host or if you simply want to Listen for incoming connections. As you can see below the state machine for the NetworkConnection is pretty simple.

    ConnectionState

    All connections start in Disconnected state.

    • Depending what state the NetworkDriver is in, the Listening (Passive) state might be triggered. This is when the driver acts like a server listening for incoming connections and data requests. And secondly you could try to use the driver to connect to a remote endpoint and then we would invoke another flow of the state machine.

    So to give a overview we have two standard scenarios. Either you listen for incoming connections or you use and outgoing connection to connect to someone else.

    In our client/server workflow we use the ServerBehaviour to Listen and the ClientBehaviour to Connect.

    Back to table of contents

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023