Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8273929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:36:04+00:00 2026-06-08T07:36:04+00:00

I have an embedded system that serves JSON results via a CGI process. I’m

  • 0

I have an embedded system that serves JSON results via a CGI process. I’m trying to setup a Flex app. to periodically poll the server once per second and update the GUI. I’m trying the approach below using a timer, but I only get the initial result, subsequent updates are not made. What could be going wrong?

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
               creationComplete="application1_creationCompleteHandler(event)">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
        <mx:HTTPService id="getPacketCounts" showBusyCursor="true" resultFormat="text" 
                        url="http://10.1.10.28/cgi-bin/getpacketcounts" 
                        requestTimeout="500"
                        result="getPacketCounts_resultHandler(event)"
                        fault="faultHandler(event)">
        </mx:HTTPService>       
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.events.FlexEvent;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;
            private var timer:Timer = new Timer(1000, 0);
            private var counter:int;

            protected function application1_creationCompleteHandler(event:FlexEvent):void
            {
                timer.addEventListener(TimerEvent.TIMER, timerListener);
                timer.start();
            }

            private function timerListener(evt:Event):void {
                label.text = "get http://10.1.10.28/cgi-bin/getpacketcounts";
                getPacketCounts.send();
            }

            protected function getPacketCounts_resultHandler(event:ResultEvent):void
            {
                label.text = event.result.toString().substr(0, 60);
            }           

            protected function faultHandler(event:FaultEvent):void
            {
                Alert.show("The server returned error code " + event.statusCode + ".", event.fault.faultString);
            }               
        ]]>
    </fx:Script>
    <s:Label id="label" text="v1.0"/>
</s:Application>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:36:04+00:00Added an answer on June 8, 2026 at 7:36 am

    I can’t see anything glaringly wrong with your code though I suspect the problem lies with your Timer getting out of sync with your HTTPService. Your Timer fires every second but it might take longer for your HTTPService to return a result and the next tick of your Timer tramples over the previous getPacketCounts.send() request. I’m not 100% sure about this though.

    If I were writing this app I’d set it up so the Timer fired once, reset the Timer, sent of the HTTPService request, then waiting for a response before restarting the Timer.

       // Make the Timer run once.
       private var timer:Timer = new Timer(1000, 1);
    
       // ....
    
       // Add listeners to the Timer and start it
       protected function application1_creationCompleteHAndler(event:FlexEvent):void
       {
           timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerListener);
           timer.start();
       }
    
       // Send the request
       private function timerListener(e:TimerEvent):void
       {
           timer.reset();
           // Your other stuff
       }
    
       protected function getPacketCounts_resultHandler(event:ResultEvent):void
       {
           timer.start()
           // Your code
       }           
    
       protected function faultHandler(event:FaultEvent):void
       {
           timer.start()
           // Your code
       } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an embedded system posting data to a JSON REST service via HTTP.
I have an embedded system that can be treated as an Access Point. There's
We have two tasks (T1 and T2) in our vxWorks embedded system that have
I have several embedded linux systems that I want to write a 'Who's Online?'
I have an embedded system running a busybox distribution and for some reason i
I have an embedded system (ARM 9263) running an RTOS, IAR tools. The system
I have an embedded system with Flash and a very low end CPU and
I have a remote embedded system which it is telnet-able. How can I download
Background of project -> I have to upgrade the Linux embedded system remotely. This
I have a Node.js web server running on an embedded Linux system. For authentication

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.