public void Server_ProcessRequest(object sender, HttpContextEventArgs e)
        {
            // Note: The GetContext method blocks while waiting for a request.
            HttpListenerContext context = e.Context;
            HttpListenerRequest request = context.Request;
            // Obtain a response object.
            HttpListenerResponse response = context.Response;
            // Construct a response.

            //        Console.WriteLine(context.Request.Url);
            // Console.WriteLine(context.Request.RawUrl);
            //        Console.WriteLine(context.Request.QueryString.ToString());

            long start = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();

            if (context.Request.LocalEndPoint.Port == VCport)
            {
                ControllerRequest(context);
            }
            ;


            if (Robots.ContainsKey(context.Request.LocalEndPoint.Port))
            {
                long finish = (DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() - start);
                Console.WriteLine("checkporttime: " + finish.ToString());
                VirtualRobot VR = Robots[context.Request.LocalEndPoint.Port];
                VR.RobotRequest(context);
            }
        }
Beispiel #2
0
        public VirtualSession(string id, int status, int port, VirtualRobot VR)
        {
            this.VR   = VR;
            this.id   = id;
            this.time = 0;
            //       this.duration = 0;
            this.status = status;
            this.port   = port;

            this.nextUpdate = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
        }
        public void CreateRobots(int VRCount)
        {
            isCreatingRobots = true;

            for (int i = 0; i < VRCount; i++)
            {
                int          port = getFreePort();
                VirtualRobot VR   = new VirtualRobot(port, VCQueue, server, BPAPrefix, influxSender);
                Robots.Add(port, VR);
            }

            this.VRCount = this.VRCount + VRCount;

            isCreatingRobots = false;
        }
 public DBQueueObject(VirtualRobot VR)
 {
     this.VR         = VR;
     this.needupdate = false;
     this.Query      = "";
 }