Skip to main content

Understand 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.


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 the client/server workflow, use the ServerBehaviour to Listen and the ClientBehaviour to Connect.