BattleNET.BattlEyeClient.Disconnect C# (CSharp) Метод

Disconnect() приватный Метод

private Disconnect ( BattlEyeDisconnectionType disconnectionType ) : void
disconnectionType BattlEyeDisconnectionType
Результат void
        private void Disconnect(BattlEyeDisconnectionType? disconnectionType)
        {
            if (disconnectionType == BattlEyeDisconnectionType.ConnectionLost)
                this.disconnectionType = BattlEyeDisconnectionType.ConnectionLost;

            keepRunning = false;

            if (socket.Connected)
            {
                socket.Shutdown(SocketShutdown.Both);
                socket.Close();
            }

            if (disconnectionType != null)
                OnDisconnect(loginCredentials, disconnectionType);
        }

Same methods

BattlEyeClient::Disconnect ( ) : void

Usage Example

Пример #1
0
        private static void Main(string[] args)
        {
            BattlEyeLoginCredentials loginCredentials = new BattlEyeLoginCredentials();
            #region
            loginCredentials.Host = args[0];
            loginCredentials.Port = Convert.ToInt32(args[1]);
            loginCredentials.Password = args[2];
            #endregion

            IBattleNET b = new BattlEyeClient(loginCredentials);
            b.MessageReceivedEvent += DumpMessage;
            b.DisconnectEvent += Disconnected;
            b.ReconnectOnPacketLoss(true);
            b.Connect();

            if (b.IsConnected() == false)
            {
                Console.WriteLine("Couldnt connect to server");
                Console.WriteLine("Failed to reload bans");
                return;
            }

            b.SendCommandPacket(EBattlEyeCommand.loadBans);
            Thread.Sleep(1000); // wait 1 second  for no reason...
            b.Disconnect();
        }
All Usage Examples Of BattleNET.BattlEyeClient::Disconnect