public RakNetSession(RakNetSocket Socket, IPEndPoint Address, byte[] ClientId)
 {
     this.Socket   = Socket;
     this.Address  = Address;
     this.ClientId = ClientId;
     Splits        = new Dictionary <UInt16, SplitPacket>();
 }
Example #2
0
        static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("Usage: Rcon <ip:port> <command> [<args> ...]");
                Console.ResetColor();
                Environment.Exit(1);
            }

            var ipPort = args[0].Split(':');
            var port   = Int32.Parse(ipPort[1]);

            Command   = args[1];
            Arguments = new string[args.Length - 2];
            Array.Copy(args, 2, Arguments, 0, args.Length - 2);

            var socket = new RakNetSocket();

            socket.SessionEstablished += OnSessionEstablished;

            // Create a disconnect timer to make sure that we disconnect after the last console message
            var timer = new System.Timers.Timer(3000);

            timer.Elapsed += OnTimedEvent;
            timer.Enabled  = true;

            IPEndPoint target = new IPEndPoint(IPAddress.Parse(ipPort[0]), port);

            socket.BeginConnection(target);
        }