Maker Pro
Maker Pro

Wifi webserver

Divedeep

Feb 2, 2014
57
Joined
Feb 2, 2014
Messages
57
Hi,

I am looking to build a webserver to display information incoming from a number of sensors.

I have purchased a RN-171XV which will arrive tomorrow.

I have been looking for some decent info on what i need to do to setup a webserver but information seems to be hard to come by.
Does anyone have any idea of what i need to do to the wifi module to get it ready and then to send data over wifi?

Im not looking for all the ins and outs, just a guide of whats required. From there i can work out what commands are needed etc and how the website data needs to be sent.

I am thinking UDP is the best option to transfer data. Is there any reason why i shouldnt??
 

kpatz

Feb 24, 2014
334
Joined
Feb 24, 2014
Messages
334
Looking at the RN-171XV on the web, I see: "Onboard TCP/IP stack includes DHCP, UDP, DNS, ARP, ICMP, HTTP client, FTP client and TCP". You would have to implement an HTTP server. The basic protocol isn't that complicated, it just accepts a connection from a client (browser) which sends a command such as "GET" and then the server responds with HTTP headers and then data, then closes the connection.

HTTP works over TCP, usually on port 80. UDP isn't useful for a web server.
 

Divedeep

Feb 2, 2014
57
Joined
Feb 2, 2014
Messages
57
Implementing the webserver i think i could do. it seems that all i have to do is look out for a get command and then reply to it with a header and the relevant data.
Im not sure how the device is set to become an access point or server. Also im not sure what settings(if any) i need to change to allow incoming connections.

Another thing im looking for an answer on is how the connection works. lets say i send a GET command from my PC, the webserver will send the relevant data. If another device were to also then send a GET command, does the webserver know the difference between the devices?? if so how??
 

kpatz

Feb 24, 2014
334
Joined
Feb 24, 2014
Messages
334
The datasheet and documentation should explain how to set it up to connect to (or create) a WiFi network.

To make it a server, you just need to have it "listen" for connections on a TCP port, such as 80 for a webserver.

If more than one device connects, they will be separate TCP connections. Assuming the TCP/IP stack supports multiple connections, your webserver would see two separate connection requests, with some sort of unique identifier for each. Then when you receive and send data, you'd use that identifier to tell it which connection you're working with.

If the stack doesn't support multiple simultaneous connections, a 2nd connection attempt would be refused until the first one finishes and is closed.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
By definition, "web" is TCP/IP connections normally through port 80.

If you want to know how to receive data from your sensors, then UDP is one possibility. However UDP is a send and forget protocol with no assurance that the packets will arrive, and if they do arrive, there is no assurance that they will arrive in order. Use such low level protocols (especially raw UDP) is pretty rare.
 

Divedeep

Feb 2, 2014
57
Joined
Feb 2, 2014
Messages
57
Hi.

I have got me a RN-XV module set up and acting as an access point. I can connect to it and i can see that ip addresses are assigned to connected devices. When i goto the server from a browser ,i.e 192.168.1.1:2000 i get an *OPEN**GET* on the serial output, this would indicate that it has received a get command from the browser??

When i try to send data back nothing happens. My browser doesnt update and the connection just stays open until i close the browser.

Anyone have any idea whats happening abd what im supposed ti do from here??
 

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
I have not used that module from Microchip, but I did use their TCP/IP stack on one of their other WiFi modules (can;t give the part without going digging). I found it somewhat unstable with connections dropping and sometimes failing to connect. The TCP/IP stack I used was the cooperative multi-processing stack implementation, which also implements the websserver, so maybe yours is different. On that stack sending stuff was quite painful and I had to be careful of flooding the WiFi module. On the other hand, using the same stack through a WiFi router worked reliably. I did not spend too much time on the WiFi module, so maybe I could have made it more reliable, but it did not matter too much in my project(model trains), so I went with the router - not as elegant but much more reliable.
 
Top