/// <summary>
        /// Accepts incoming npc service connection.
        /// </summary>
        /// <param name="s">Accepted <see cref="Socket"/> object.</param>
        internal static void AcceptConnection( Socket s )
        {
            if ( s == null || !s.Connected )
                return;

            if ( !Active )
            {
                NetworkHelper.RemoteServiceInfo info = NetworkHelper.GetServiceInfo(s);

                if ( info.ServiceType == ServiceType.NpcService )
                {
                    m_NpcServerConnection = new InnerNetworkClient(info.ServiceId, info.ServiceType, s);

                    NpcServiceRequestsHandlers nsrh = new NpcServiceRequestsHandlers(ref m_NpcServerConnection);
                    //m_NpcServerConnection.OnDisconnected += new OnDisconnectedEventHandler(NpcServerConnection_OnDisconnected);
                    m_NpcServerConnection.HandleDelegate = nsrh.Handle;
                    m_NpcServerConnection.Send(new InitializeResponse(Settings.Default.ServiceUniqueID, ( byte )ServiceType.GameService, InitializeResponse.Accepted).ToPacket());

                    Active = true;

                    Logger.WriteLine(Source.InnerNetwork, "Connection accepted for {0} (0x{1})", info.ServiceType, info.ServiceId.ToString("x2"));

                }
            }
        }
        /// <summary>
        /// Serves for connections acceptance.
        /// </summary>
        /// <param name="socket">Accepted <see cref="Socket"/>.</param>
        internal static void AcceptConnection( Socket socket )
        {
            if ( socket == null || !socket.Connected )
                return;

            NetworkHelper.RemoteServiceInfo info = NetworkHelper.GetServiceInfo(socket);

            if ( info.ServiceType == ServiceType.Undefined )
            {
                Console.WriteLine("Connection rejected for remote connection from {0}, service was not recognized.", socket.RemoteEndPoint);
                NetworkHelper.CloseSocket(ref socket);
                return;
            }

            if ( m_ActiveConnections.ContainsKey(info.ServiceId) )
            {
                Console.WriteLine("{0} with id 0x{1} already connected, skipping connection request.", info.ServiceType, info.ServiceId);
                NetworkHelper.CloseSocket(ref socket);
                return;
            }

            InnerNetworkClient client = null;

            switch ( info.ServiceType )
            {
                case ServiceType.LoginService:
                    {
                        client = new InnerNetworkClient(info.ServiceId, info.ServiceType, socket);
                        client.OnDisconnected += new OnDisconnectedEventHandler(OnRemoteConnectionError);
                        client.HandleDelegate = new LoginServiceRequestsHandlers(ref client).Handle;

                        break;
                    }
                case ServiceType.GameService:
                    {
                        client = new InnerNetworkClient(info.ServiceId, info.ServiceType, socket);
                        client.OnDisconnected += new OnDisconnectedEventHandler(OnRemoteConnectionError);
                        client.HandleDelegate = new GameServiceRequestsHandlers(ref client).Handle;
                        break;
                    }
                case ServiceType.NpcService:
                    {
                        client = new InnerNetworkClient(info.ServiceId, info.ServiceType, socket, NpcServiceRequestsHandlers.Handle);
                        break;
                    }
                default:
                    {
                        throw new InvalidOperationException();
                    }
            }

            Logger.WriteLine(Source.InnerNetwork, "Connection accepted for {0} (0x{1})", client.ServiceType, client.ServiceID.ToString("x2"));
            client.Send(m_ResponseAccepted);
            client.BeginReceive();
            m_ActiveConnections.Add(info.ServiceId, client);
        }