Forge Developers | Slack Search | Trello Board Changelog
|
Forge Networking Remastered has been released!!! This is now listed in your Profile!
Go Back

Connecting to a Server

Main Method Call

Connecting to a server/host is as simple as calling one function Networking.Connect at any time. Below is a sample of the method and its arguments.

Connection Events

When you attempt to host a server you can register connection events, register connection failure events, or check if the connection is currently established.

To check if a connection is established, you can use the following:

To register a delegate to the connected event (which fires as soon as the port is bound and listening) you just need to assign the event directly to the socket.

Disconnection Events

I think we all need to know when the network has died so that we can not have our game simply crash. So, in order to find out when we are disconnected, we will need to register the Networking.Socket[15937].disconnected event.

You can also use the Networking.Sockets[15937].serverDisconnected event to execute logic for when the server disconnects the player for any given reason.

Title

Body

Title

Body


Input:

Title

Body


Input: