void OnClientIntroductionCallback(CClientSocket ClientSocket, int ConnectionIndex, byte[] arguments)
        {
            SClientIntroduction ClientIntroduction = (SClientIntroduction)CSerialization.Deserialize <SClientIntroduction>(arguments);

            SConnection Connection = Connections[ConnectionIndex];

            Connection.Information       = ClientIntroduction;
            Connections[ConnectionIndex] = Connection;
        }
        static SClient GetClientStructFromConnection(SConnection Connection)
        {
            SClientIntroduction ClientIntroduction = (SClientIntroduction)Connection.Information;

            SClient ClientInfo = new SClient
            {
                IPAddress       = Connection.ClientSocket.GetIPv4(),
                SocketHandle    = Connection.ClientSocket.GetHandle(),
                UserName        = ClientIntroduction.UserName,
                OperatingSystem = ClientIntroduction.OperatingSystem
            };

            return(ClientInfo);
        }
예제 #3
0
        private void ClientSocket_OnClientConnected()
        {
            //Tell the server that this is a client
            byte[] buffer = BitConverter.GetBytes((int)2);
            ClientSocket.SendBuffer(buffer);

            SClientIntroduction ClientIntroduction = new SClientIntroduction
            {
                UserName        = Environment.UserName,
                OperatingSystem = new Microsoft.VisualBasic.Devices.ComputerInfo().OSFullName //sure there are better ways, but for the sake of open-source - i don't really care
            };

            //Send the introduction
            ClientSocket.SendPacket <SClientIntroduction>((byte)EClientPackets.Introduction, ClientIntroduction);
        }