Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
        public DefaultNpcHtmlGenerator(String htmlPageTitle, NpcExecutor npcExecutor)
        {
            if (npcExecutor == null)
            {
                throw new ArgumentNullException("npcExecutor");
            }

            this.htmlPageTitle = htmlPageTitle;
            this.npcExecutor   = npcExecutor;
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
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;
        }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
 public NpcServerMultiThreaded(INpcServerCallback callback, NpcExecutor npcExecutor, String htmlPageTitle, UInt16 port)
     : this(callback, npcExecutor, new DefaultNpcHtmlGenerator(htmlPageTitle, npcExecutor), port)
 {
 }