GetSessionID() public method

public GetSessionID ( ) : uint
return uint
        public void DisconnectClient(SOEClient client, ushort reason, bool clientBased = false)
        {
            // Disconnect
            Log("Disconnecting client on {0} (ID: {1}) for reason: {2}", client.GetClientAddress(), client.GetClientID(), (SOEDisconnectReasons)reason);

            // Are they a connected client?
            if (Clients.Contains(client))
            {
                // We don't care about them anymore
                // Open their ID as a space
                Host2ClientID.Remove(client.Client);
                SessionID2ClientID.Remove(client.GetSessionID());
                Clients[client.GetClientID()] = null;
            }

            // Was this a disconnect request from the client itself?
            if (!clientBased)
            {
                // Tell them we're disconnecting them
                SOEWriter packetWriter = new SOEWriter((ushort)SOEOPCodes.DISCONNECT);

                // Arguments
                packetWriter.AddUInt32(client.GetSessionID());
                packetWriter.AddUInt16(reason);

                // Send!
                SOEPacket packet = packetWriter.GetFinalSOEPacket(client, true, false);
                client.SendPacket(packet);
            }
        }
        public void AddNewClient(SOEClient newClient)
        {
            // Do they exist already?
            if (SessionID2ClientID.ContainsKey(newClient.GetSessionID()))
            {
                // Disconnect the new client
                Log("[WARNING] Someone tried connecting with the same Session ID!");
                newClient.Disconnect((ushort)SOEDisconnectReasons.ConnectFail);

                // Don't continue adding this connection
                return;
            }

            // Is there already a connection from this endpoint?
            if (Host2ClientID.ContainsKey(newClient.Client))
            {
                // Disconnect the new client
                Log("[WARNING] Someone tried connecting from the same endpoint!");
                newClient.Disconnect((ushort)SOEDisconnectReasons.ConnectFail);

                // Don't continue adding this connection
                return;
            }

            // Loop through the Clients list, looking for an open space
            int newClientId;

            for (newClientId = 0; newClientId < Clients.Count; newClientId++)
            {
                // Is this client nulled?
                if (Clients[newClientId] == null)
                {
                    // We've found an empty space!
                    break;
                }
            }

            // Set their Client ID
            newClient.SetClientID(newClientId);

            // Add them to the Clients map
            if (newClientId >= Clients.Count)
            {
                Clients.Add(newClient);
            }
            else
            {
                Clients[newClientId] = newClient;
            }

            // Add them to our maps
            Host2ClientID.Add(newClient.Client, newClientId);
            SessionID2ClientID.Add(newClient.GetSessionID(), newClientId);

            // Log
            Log("New client connection from {0}, (ID: {1})", newClient.GetClientAddress(), newClient.GetClientID());
        }
        public void AddNewClient(SOEClient newClient)
        {
            // Do they exist already?
            if (SessionID2ClientID.ContainsKey(newClient.GetSessionID()))
            {
                // Disconnect the new client
                Log("[WARNING] Someone tried connecting with the same Session ID!");
                newClient.Disconnect((ushort)SOEDisconnectReasons.ConnectFail);

                // Don't continue adding this connection
                return;
            }

            // Is there already a connection from this endpoint?
            if (Host2ClientID.ContainsKey(newClient.Client))
            {
                // Disconnect the new client
                Log("[WARNING] Someone tried connecting from the same endpoint!");
                newClient.Disconnect((ushort)SOEDisconnectReasons.ConnectFail);

                // Don't continue adding this connection
                return;
            }

            // Loop through the Clients list, looking for an open space
            int newClientId;
            for (newClientId = 0; newClientId < Clients.Count; newClientId++)
            {
                // Is this client nulled?
                if (Clients[newClientId] == null)
                {
                    // We've found an empty space!
                    break;
                }
            }

            // Set their Client ID
            newClient.SetClientID(newClientId);

            // Add them to the Clients map
            if (newClientId >= Clients.Count)
            {
                Clients.Add(newClient);
            }
            else
            {
                Clients[newClientId] = newClient;
            }

            // Add them to our maps
            Host2ClientID.Add(newClient.Client, newClientId);
            SessionID2ClientID.Add(newClient.GetSessionID(), newClientId);

            // Log
            Log("New client connection from {0}, (ID: {1})", newClient.GetClientAddress(), newClient.GetClientID());
        }
Beispiel #4
0
        public void HandleDisconnect(SOEClient sender, SOEPacket packet)
        {
            // Setup a reader
            SOEReader reader = new SOEReader(packet);

            // Get the data from the packet
            uint sessionID = reader.ReadUInt32();
            ushort reason = reader.ReadUInt16();

            // Handle
            if (sessionID == sender.GetSessionID())
            {
                Console.WriteLine("Disconnecting");
                Server.ConnectionManager.DisconnectClient(sender, reason, true);
            }
        }
Beispiel #5
0
        public void HandleDisconnect(SOEClient sender, SOEPacket packet)
        {
            // Setup a reader
            SOEReader reader = new SOEReader(packet);

            // Get the data from the packet
            uint   sessionID = reader.ReadUInt32();
            ushort reason    = reader.ReadUInt16();

            // Handle
            if (sessionID == sender.GetSessionID())
            {
                Console.WriteLine("Disconnecting");
                Server.ConnectionManager.DisconnectClient(sender, reason, true);
            }
        }
        public void DisconnectClient(SOEClient client, ushort reason, bool clientBased = false)
        {
            // Disconnect
            Log("Disconnecting client on {0} (ID: {1}) for reason: {2}", client.GetClientAddress(), client.GetClientID(), (SOEDisconnectReasons)reason);

            // Are they a connected client?
            if (Clients.Contains(client))
            {
                // We don't care about them anymore
                // Open their ID as a space
                Host2ClientID.Remove(client.Client);
                SessionID2ClientID.Remove(client.GetSessionID());
                Clients[client.GetClientID()] = null;
            }

            // Was this a disconnect request from the client itself?
            if (!clientBased)
            {
                // Tell them we're disconnecting them
                SOEWriter packetWriter = new SOEWriter((ushort)SOEOPCodes.DISCONNECT);

                // Arguments
                packetWriter.AddUInt32(client.GetSessionID());
                packetWriter.AddUInt16(reason);

                // Send!
                SOEPacket packet = packetWriter.GetFinalSOEPacket(client, true, false);
                client.SendPacket(packet);
            }
        }