/// <summary> /// Disconnects from the netServer. /// </summary> public void ClientDisconnect() { if (IsMPServerInitialized) { Log.Warning("Could not disconnect from server. Server is initialized."); return; } if (!IsMPClientInitialized) { Log.Warning("Could not disconnect from the server. Client is not initialized."); return; } Log.Message("Disconnecting from server."); MPClient.DisconnectFromServer(); Log.Message("Disconnected from server."); }
/// <summary> /// Connects to a remote netServer. /// </summary> /// <param name="ip">The IP address of the netServer.</param> /// <param name="port">The port of the netServer.</param> /// <param name="password">The netServer password.</param> public void ClientConnect(string ip, int port, string password) { if (IsMPServerInitialized) { Log.Warning("Cannot connect client to server. Server is initialized."); return; } if (!IsMPClientInitialized) { Log.Warning("Cannot connect client to server. CLient is not initialized."); } Log.Message("Connecting client."); MPClient.ConnectToServer(ip, port, password); Log.Message("Client connected."); }
/// <summary> /// Connect to localhost on port 4230 with no password (""). /// </summary> public void ClientConnect() { if (IsMPServerInitialized) { Log.Warning("Cannot connect client to server. Server is initialized."); return; } if (!IsMPClientInitialized) { Log.Warning("Cannot connect client to server. CLient is not initialized."); } Log.Message("Connecting client."); MPClient.ConnectToServer(); Log.Message("Client connected."); }
//CLIENT// #region netClient stuff /// <summary> /// Initilializes the Client if it is not already initialized and the MPServer is not initialized. /// </summary> public void ClientInitialize() { if (IsMPServerInitialized) { Log.Warning("Cannot initialize the client. Server is initilalized"); return; } if (IsMPClientInitialized) { Log.Warning("Client is already initialized."); } Log.Message("Initializing client."); MPClient = new MPClient(StopProcessMessageThread); MPClient.clientLeavingProcessMessageThread += MPClient_clientLeavingProcessMessageThread; MPClient.clientConnected += MPClient_clientConnectedEvent; MPClient.clientDisconnected += MPClient_clientDisconnectedEvent; mpClient.receivedUnhandledMessage += mpClient_receivedUnhandledMessage; SetMPRole(MPRoleType.Client); Log.Message("Client initialized."); }
/// <summary> /// Initilializes the Client if it is not already initialized and the MPServer is not initialized. /// </summary> public void ClientInitialize() { if (IsMPServerInitialized) { Log.Warning("Cannot initialize the client. Server is initilalized"); return; } if (IsMPClientInitialized) { Log.Warning("Client is already initialized."); } Log.Message("Initializing client."); MPClient = new MPClient(StopProcessMessageThread); MPClient.clientLeavingProcessMessageThread += MPClient_clientLeavingProcessMessageThread; MPClient.clientConnected += MPClient_clientConnectedEvent; MPClient.clientDisconnected += MPClient_clientDisconnectedEvent; mpClient.receivedUnhandledMessage += mpClient_receivedUnhandledMessage; SetMPRole(MPRoleType.Client); Log.Message("Client initialized."); }