11 years, 2 months ago.

Has anyone succeeded in making a Wifly HTTP server?

Hi Sam,

I'm trying to assemble an HTTP server using a Roving Networks Wifly module. I can successfully compile and run the HTTPServerExample in the cookbook, using ethernet, including the RPC protocol. And I can successfully compile and run your WiflyHelloWorld example, join my wifi network, and telnet to the Wifly module via wifi. However, if I import the official mbed Wifly interface into the HTTPServerExample, the compiler reports many "TCPSocket" is undefined and "TCPSocketEvernt" is undefined errors arising from the HTTPRequestHandler and TTPRequestDispatcher. These are deep in the HTTPServer library. If I delete the EthernetNetIF library and the #include "EthernetNetIf.h" statement (still keeping the WiflyInterface library and calling it with #include "WiflyInterface.h") then the compiler gives a different error: "cannot open source input file "core/net.h": No such file or directory. This one is also from the HTTP Server library.

Has anyone succeeded in combining the HTTP Server Library with the Wifly Library? Or is there a different way to implement an HTTP server over the Wifly interface?

Thanks.

Y.

Question relating to:

1 Answer

11 years, 1 month ago.

At this stage, I wouldn't call what I made robust - some of the issues are noted on the Smart WiFly page, but it might represent a start. If you do give it a go, feedback is appreciated! Note that this is build on what must be an old WiFly library - the latest is a lot different, but I was unable to make the samples work.

I have made a number of improvements in my attempts. It is now robust enough that a simple web server running on WiFly can be accessed, and if I come back the next day it is still "online". Early in my work it wouldn't hold a connection for more than some minutes to an hour. Truth be told, I don't know what caused that. As a web server, one of the limitations I'm facing right now is serving multiple objects from one page (e.g. an image embedded in the page). The browser seems to be asking for the page, gets that, and then asking for the image - but I don't see that request come in, so it is not served. Right-click and 'show image' then fetches the image just fine.

[Edit] The Wifly module can only handle a single request at a time, and the case of the image, the request comes in overlapping with the delivery of the page content. The 2nd request is then lost. My band-aid for this was a tiny bit of javascript. After the page finishes loading, then the javascript updates the image.Here's a handy link to the Cookbook - WiflyInterface page.

posted by David Smart 20 Jun 2013