Marcia Dunn

MCF52235 EVB. CodeWarrior. Niche_Lite. HTTP Web Client

Discussion created by Marcia Dunn on Apr 3, 2007
Latest reply on Apr 16, 2008 by David Demers
Hi Everyone,
I'm hoping that some of you guys can help me by providing some general guidance. I am a newbie on this forum, but pretty experienced with Coldfire and CodeWarrior.
OK, I have 32 remote products, which I want to monitor over ethernet. They are each on my client's enterprise networks, and I want a keep-alive from each box every 5 minutes, and to report a status byte when anything changes. I had planned to use the AJAX technique described in the Web_Server_with_labs material, but of course got caught out by the enterprise firewalls. I now need to change my thinking from the board running a web server (HTTP server) to running a web client. Every 5 minutes, the CF board can send a HTTP packet over to my local server:
I have a CGI script running on my server, and the http request I plan to make every 5 minutes is:
So now I have a web client which can make a HTTP request to my server. But I need your advice on the InterNiche web client. As it stands, the freescale_http demo is a web server.
I know I have to do this:
M_SOCK socket = m_socket();
int m_connect(M_SOCK socket, struct sockaddr_in * sin, M_CALLBACK(my cb function));
bytes_sent = m_send (socket, data, length);
I have found it challenging to turn this theory into a workable CW project, and I'm not sure how I should be handling the response from my server - it's just a HTTP/1.1 200 OK frame. Also, when I run the Freescale http server, and break to look at the socket it is using, there is lots of data in the socket. Does the m_socket() function populate this for me? How do I set blocking and unblocking, etc. I dont think I really understand the sockaddr structure in the m_connect, also.
Does anyone have any advice that you could share with me??