Main Site Documentation

Message from Xbee could not received by FEZ spider when using also HttpListener


#1

Hello,
I’m trying to make a communication between FEZ spider and LCD using Xbee, and at the same time with a browser.
When Http Server thread (which use HttpListener) is not launched, Xbee function run correctly. Every 1 second FEZ spider receive message from LCD and display it in the debugger. But when HttpListener is running, xbee_MessageReceived() function is not called.

Some times Spider receives the message when I refresh the html page in browser.
Same behaviour with Xbee sending message from spider to LCD.

What am I doing wrong ?

Please refer to attached file.


#2

I did this:


        void ProgramStarted()
        {
            xBeeTimer.Tick += new GT.Timer.TickEventHandler(xBeeTimer_Tick);
            xBeeTimer.Start();
           
             .........................
            
            Debug.Print("IP Address assigned !!!");

            Thread t = new Thread(new ThreadStart(ThreadProc));
            t.Start();
        }


        private void ThreadProc()
        {
            try
            {
                // Now everything is ok with the Network, launch the Http Server thread...
                httpServer.Start();
                Debug.Print("HttpServer launched");
            }
            catch (Exception e)
            {
                Debug.Print(e.Message);
            }
        }

But I have the same behaviour

ListenTimer_Tick and xBeeTimer_Tick are not work except if I refresh the page !..


#3

I’m using HttpListener in the synchronous model. This block while waiting for a client request. Using the synchronous model, call the GetContext method, which waits for a client to send a request

Finally when I run ListenTimer_Tick function in new thread it work :slight_smile: