public void ConnectToServer(string ip, ushort port = PORT) { isServer = false; client = Client.Instance; client.Initialize(ip, port); server = Server.Instance; if (client.Initialized()) { server.Initialize(port++); } else { throw new Exception("Cannot start connection"); } }
public void StartServer(ushort port = PORT) { isServer = true; server = Server.Instance; client = Client.Instance; server.Initialize(port); if (server.Initialized()) { client.Initialize(server.GetClientIP(), port++); } else { throw new Exception("Cannot start connection"); } }