Page 288 - Anatomy of a Robot
P. 288
09_200256_CH09/Bergren 4/17/03 11:25 AM Page 273
COMMUNICATIONS 273
TCP (Error-Free) Communication
If error-free data transfers are required, the data session on the LAN must be set up with
a socket connection. Every computer attached to the LAN (and Internet) has a specific
address. Most of the communications will be between the robot and a specific computer
(point to point). The connection must first be established before transfers can take place.
Most computer software operating systems have stacks (modeled after the OSI stack)
that assist in the formation of all the connections that are needed.
Although the software is not difficult to write, it makes sense to get an experienced
software engineer to write LAN communication software. If an inexperienced person
writes the software, it will have errors that will cause significant problems later. The
programmer will bring up the software stack, obtain an IP address, establish the con-
nection (termed a socket), transfer all the data, and close the socket at the end of the
session. The following web sites outline the connection process:
www.cs.rpi.edu/courses/sysprog/sockets/sock.html
www.ecst.csuchico.edu/ beej/guide/net/html/
http://java.sun.com/docs/books/tutorial/networking/sockets/
www.exegesis.uklinux.net/gandalf/winsock/ (for Windows)
www.cs.berkeley.edu/ kfall/EE122/lec23/sld001.htm
User Datagram Protocol (UDP) Connectionless
Communications
Sometimes error-free communication is not required. In fact, sometimes it is impossi-
ble. Consider video communications. Because video receivers require a constant stream
of data, no time is available at all to go backwards and retransmit the information in
error. Instead, the video screen simply freezes for a while until new data comes along.
The sending computer need not forge a connection in advance. It can simply determine
the IP address of the receiving computer and start transmitting. The receiving computer
need not send signals back at all.
Broadcasting
In fact, if the IP addresses are set up properly, multiple computers can receive the trans-
mitted data (also called UDP datagrams) at the same time. This technique is called
broadcasting and is a useful way to ask around for information. The sending computer
can ask via UDP broadcasting, for instance, if any other computer has specific infor-
mation. Computers wanting to reply can establish a TCP connection to reply privately.