Example #1
0
        public Client(Server server, SocketClient socket)
        {
            IsClosed = false;
            _server = server;
            Socket = socket;

            socket.DataReceived += HandleDataReceived;
            socket.ConnectionLost += HandleConnectionLost;

            _readBuffer = new byte[1024 * 64];
            _readBufferSize = 0;

            InputArc4 = null;
            OutputArc4 = null;

            var welcome = new PacketWriter();
            welcome.Write((ushort)3);
            welcome.Write((ushort)201);
            welcome.Write((ushort)0);
            welcome.Write((ushort)0);
            SendPacket(0x03, 0x08, 0, welcome.ToArray());
        }
Example #2
0
        public void Start()
        {
            Logger.WriteInternal("Server starting at " + DateTime.Now);

            Server = new Server();

            Config.Load();

            PacketHandlers.LoadPacketHandlers();

            Logger.WriteInternal("[DB ] Loading database...");
            using (var db = new PolarisEf())
            {

                db.SetupDB();
            }

            for (var i = 0; i < 10; i++)
                QueryServers.Add(new QueryServer(QueryMode.ShipList, 12099 + (100 * i)));

            Server.Run();
        }