ConnectToServerUtility
A static class in Root.Township, Alta.Networking.Servers.
Client: joins a game server. Keeps one client socket and one join attempt at a time, and sets up message handlers once joined.
- Listed in Networking and servers
- Documented in Joining a server
Fields
3 private and internal fields
| Member | What it is |
|---|---|
private static JoinServerPipeline joinServerPipeline | The join attempt in progress. |
private static readonly Logger logger | Logger for this class. |
private static ISocket socket | The client socket. |
Methods
| Member | What it is |
|---|---|
static async Task<JoinResult> ConnectToServer(GameServerInfo server) | Creates the client socket if needed, cancels any other join in progress, and runs a JoinServerPipeline to the server. |
static void StopCurrentConnectionAttempt() | Closes the client socket and cancels the join attempt. |
4 private and internal methods
| Member | What it is |
|---|---|
private static void CleanStaticSocket(ISocket obj) | Clears the socket and join attempt when the socket is destroyed. |
private static void HandleConnectionResultToServer(JoinResult result) | On success, raises the client started event and sets up the connection's message handlers. |
private static void SerializePause(Connection connection, Stream stream) | Writes whether the application is paused; not hooked up here. |
private static void SetupConnectionToServer(Connection connection) | Sets the handlers for server messages such as spawn, destroy, move, entity sync and ping. |