示例#1
0
        public Transaction(Server server, ITcpSocket socket, ConnectionCallback callback, bool closeOnEnd = false)
        {
            Server = server;
            Socket = socket;
            this.closeOnEnd = closeOnEnd;

            Context = server.Context;

            ConnectionCallback = callback;

            gc_handle = GCHandle.Alloc(this);

            Request = new Request(this, socket);
            Request.Read(Close);
        }
示例#2
0
        public static Transaction BeginTransaction(Server server, ITcpSocket socket, ConnectionCallback cb, bool closeOnEnd = false)
        {
            Transaction transaction = new Transaction(server, socket, cb, closeOnEnd);

            return transaction;
        }
示例#3
0
        public static void Start(Application application)
        {
            if (application == null)
                throw new ArgumentNullException("application");

            app = application;

            app.StartInternal();

            foreach (var ep in listenEndPoints)
            {
                var server = new Server(Context, HandleTransaction, Context.CreateTcpServerSocket(ep.AddressFamily));
                server.Listen(ep.Address.ToString(), ep.Port);

                servers.Add(server);
            }
            foreach (var ep in secureListenEndPoints.Keys)
            {
            //				var keypair = secureListenEndPoints [ep];
            //				var socket = Context.CreateSecureSocket (keypair.Item1, keypair.Item2);
            //				var server = new HttpServer (context, HandleTransaction, socket);
            //				server.Listen (ep.Address.ToString (), ep.Port);
            //
            //				servers.Add (server);
            }

            context.Start();
        }