Pick the Network Protocol that’s Right for your Device
Figure 2. Use the Packet Whacker to add Ethernet to just about
any CPU with a parallel interface.
UDP communications via the Winsock control.
Serving Interactive Web Pages
One of the most popular ways for computers to share
information in networks is via web pages. Many web
pages are static, unchanging displays of information, but
small devices usually want to serve pages that display
real time information or receive and act on user input.
My article, “Control Your Devices from a Web Page,” in
the March 2004 Nuts & Volts showed one example. I used
a Dallas Semiconductor TINI module to serve a page that
enables users to monitor and control the device.
Requests for web pages use the Hypertext Transfer
Protocol (HTTP). The requests and the responses
containing the web pages travel in TCP segments. To
serve web pages, a device must support TCP and IP and
must know how to respond to received requests.
For creating web pages that display real time data
and respond to user input, there are several options.
Devices programmed in C often use the Server Side
Include (SSI) and Common Gateway Interface (CGI)
protocols. Rabbit Semiconductor’s Dynamic C for its
RabbitCore modules supports both.
Devices programmed in Java can use a servlet
engine that enables running Java servlets, which extend
a server’s abilities. Two servlet engines for TINIs and
other small systems are the Tynamo from Shawn
Silverman and TiniHttpServer from Smart SC Consulting.
A third option is to use a product-specific protocol
that defines how a device can insert real time data into
web pages and receive user input. Netmedia’s SitePlayer
and Redpoint Controls’ Red-i BASIC Stamp Web Server
are examples of this approach.
Exchanging Messages via Email
Email is another option that small devices can use to
communicate in networks. Email’s original purpose, of
course, was to enable humans to exchange messages,
but devices can also be programmed to send and receive
messages without human intervention.
Just like a person, a device can have its own Email
account, user name, and password. The device firmware
can compose messages to send and process received
messages to extract the information inside.
For example, a security system can send a message
when an alarm condition occurs or a device can receive
configuration commands in an Email message.
With Email, the sender can send a message whenever
it wants and recipients can retrieve and read their messages
whenever they want. The downside is that recipients may
not get information as quickly as needed if they don’t check
their Email or if a server backs up and delays delivery.
To send and receive Emails on the Internet, a device
must have an Internet connection, an Email account that
provides access to incoming and outgoing mail servers,
and support for TCP/IP and the protocols used by the mail
servers to send and retrieve Email. Two protocols suitable
for small systems are the Simple Mail Transfer Protocol
(SMTP) for sending Email and the Post Office Protocol Version 3 (POP3) for retrieving Email.
Exchanging Files with
NUTS & VOLTS
Packet Whacker Ethernet board.
and Internet Central Links to
sources for modules and code.
SitePlayer Web Server.
RabbitCore modules and Dynamic C.
Red-i BASIC Stamp Web Server.
Smart SC Consulting
TiniHttpServer web server and
Java servlet engine.
Web server and Java servlet engine.
Devices that store information in
files can use FTP to exchange files with
remote computers. Every FTP communication is between a server — which
stores files and responds to commands
from remote computers — and a client —
which sends commands that request to
send or receive files. A device may function as either a server or client.
To use FTP, a device must support a
file system where blocks of information
are stored in named entities called files. In