public int Listen()
        {
            try {
                Logger.Write(LogLevel.Debug, "Listening on port: {0}", config.Port);
                Logger.Write(LogLevel.Debug, "Listening on address: {0}", config.Address);

                this.listener = CreateSocket(config.Family, config.Address, config.Port);

                listener.Listen(500);
                listener.BeginAccept(accept, listener);
            } catch (Exception ex) {
                Logger.Write(LogLevel.Error, "{0}", ex);
                return(1);                //false;
            }
            Logger.Write(LogLevel.Debug, "Application started");

            return(0);            //true;
        }
        public void acceptCallback(IAsyncResult ar)
        {
            GeneralSocket listener = (GeneralSocket)ar.AsyncState;
            Socket        client   = null;

            try {
                client = listener.EndAccept(ar);
            }
            catch (ObjectDisposedException) {
                //socket has been closed in Shutdown method
            }

            if (client != null)
            {
                listener.BeginAccept(accept, listener);

                // Additional code to read data goes here.
                FastCgiNetworkConnector connector = new FastCgiNetworkConnector(client, this);
                connector.Disconnected += OnDisconnect;

                connector.Receive();
            }
        }