Application for the serial Com-Server:
Put your own serial device onto the Web
This is now possible for everyone, thanks to the sockets integrated in the Com-Server!
When a network connection for his testing equipment became an issue for the programmer, he estimated that it would take at least one year to develop a suitable Ethernet TCP/IP stack. Luckily, his boss knew about the small W&T Com-Server module with which this task could be reduced to the modification of a few ASCII strings of the HTTP protocol.
Your serial device must only be capable of recognizing the short ASCII strings of the HTTP protocol and of selecting a response corresponding to the "file names" contained in the strings. This response consists of a standard HTML file that can be generated by means of a simple ASCII editor. That’s all that is needed to make your device web-capable!The HTTP request
The request generated by the browser always consists of a request line that might be followed by additional lines. The end of an HTTP header is indicated by a blank line.
The entry of
http://www.geraet.de/status in the browser results in the following HTTP request at the serial side of the Com-Server:
GET<Space>/status<Space>HTTP/1.1<CRLF> [Option 1]<CRLF> [Option 2]<CRLF> [Option n]<CRLF>
Therefore, you must only inspect the beginning of the first line. The rest can simply be ignored.The HTTP reply
The HTTP server is able to generate the desired response by analyzing the forwarded ASCII string. The HTTP specification ensures that the generation and return of an HTTP header is not required so that the requested data can be sent without delay. The data must be transferred in HTML format to be viewed in the browser. A basic response might for example look like this:
<html> Station OK </html>
With this method, all functions of a web server can be implemented. From a simple status query or remote configuration to complex live visualization and remote updates - all you need is a standard web browser on the client side.