Example #1
0
 public NpcBlockingThreadHander(String clientString, INpcServerCallback callback, Socket socket,
                                NpcExecutor npcExecutor, INpcHtmlGenerator npcHtmlGenerator)
     : base(clientString, callback, npcExecutor, npcHtmlGenerator)
 {
     this.socket           = socket;
     this.socketLineReader = new SocketLineReader(socket, Encoding.ASCII, Buf.DefaultInitialCapacity, Buf.DefaultExpandLength);
 }
Example #2
0
        public NpcServerSingleThreaded(INpcServerCallback callback, NpcExecutor npcExecutor, INpcHtmlGenerator htmlGenerator, UInt16 port)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (npcExecutor == null)
            {
                throw new ArgumentNullException("npcExecutor");
            }
            if (htmlGenerator == null)
            {
                throw new ArgumentNullException("htmlGenerator");
            }

            this.callback      = callback;
            this.npcExecutor   = npcExecutor;
            this.htmlGenerator = htmlGenerator;

            Socket listenSocket = new Socket(IPAddress.Any.AddressFamily, SocketType.Stream, ProtocolType.Tcp);

            listenSocket.Bind(new IPEndPoint(IPAddress.Any, port));
            listenSocket.Listen(Backlog);
            callback.ServerListening(listenSocket);

            selectServer = new SelectServer(false, new Buf(SingleThreadedReceiveBufferLength));
            selectServer.control.AddListenSocket(listenSocket, AcceptCallback);
        }
Example #3
0
        public NpcSocketHandler(String clientString, INpcServerCallback callback, NpcExecutor npcExecutor, INpcHtmlGenerator npcHtmlGenerator)
            : base(clientString, callback, npcExecutor, npcHtmlGenerator)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            this.lineParser = new LineParser(Encoding.ASCII, Buf.DefaultInitialCapacity, Buf.DefaultExpandLength);
        }
Example #4
0
        public NpcSelectServerHandler(INpcServerCallback callback, NpcExecutor npcExecutor, INpcHtmlGenerator htmlGenerator)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (npcExecutor == null)
            {
                throw new ArgumentNullException("npcExecutor");
            }
            if (htmlGenerator == null)
            {
                throw new ArgumentNullException("htmlGenerator");
            }

            this.callback      = callback;
            this.npcExecutor   = npcExecutor;
            this.htmlGenerator = htmlGenerator;
        }
Example #5
0
        public NpcHandler(String clientString, INpcServerCallback callback, NpcExecutor npcExecutor, INpcHtmlGenerator npcHtmlGenerator)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (npcExecutor == null)
            {
                throw new ArgumentNullException("npcExecutor");
            }
            if (npcHtmlGenerator == null)
            {
                throw new ArgumentNullException("npcHtmlGenerator");
            }

            this.clientString = clientString;

            this.callback      = callback;
            this.npcExecutor   = npcExecutor;
            this.htmlGenerator = npcHtmlGenerator;
        }
Example #6
0
        public NpcServerMultiThreaded(INpcServerCallback callback, NpcExecutor npcExecutor, INpcHtmlGenerator htmlGenerator, UInt16 port)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (npcExecutor == null)
            {
                throw new ArgumentNullException("npcReflector");
            }
            if (htmlGenerator == null)
            {
                throw new ArgumentNullException("htmlGenerator");
            }

            this.callback      = callback;
            this.npcExecutor   = npcExecutor;
            this.htmlGenerator = htmlGenerator;
            this.port          = port;
            this.keepRunning   = false;
        }
Example #7
0
        public NpcServerSingleThreaded(INpcServerCallback callback, NpcExecutor npcExecutor, INpcHtmlGenerator htmlGenerator, Socket listenSocket)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (npcExecutor == null)
            {
                throw new ArgumentNullException("npcExecutor");
            }
            if (htmlGenerator == null)
            {
                throw new ArgumentNullException("htmlGenerator");
            }

            this.callback      = callback;
            this.npcExecutor   = npcExecutor;
            this.htmlGenerator = htmlGenerator;

            selectServer = new SelectServer(false, new Buf(SingleThreadedReceiveBufferLength));
            selectServer.control.AddListenSocket(listenSocket, AcceptCallback);
        }
Example #8
0
 public NpcServerMultiThreaded(INpcServerCallback callback, NpcExecutor npcExecutor, String htmlPageTitle, UInt16 port)
     : this(callback, npcExecutor, new DefaultNpcHtmlGenerator(htmlPageTitle, npcExecutor), port)
 {
 }