Communications Basics

To communicate from one computer to another, you need a communications program on each machine, and some way to connect them (telephone lines, for example).  Sometimes, those programs are built into the operating system.  Even when that's the case, there will be times when you want to do something faster, more reliably, or in a different manner than what has been provided.

To communicate, you will need a way for each program to inform the other that:

1.        It is ready/not ready to transmit/receive data.

2.        Data has been received and is correct.

3.        Data has been received and is not correct.

4.        Transmission is over.

If it is not important to check for, or correct errors, items 2 and 3 in the previous list can be ignored.  Those capabilities are often skipped when the programs are to be used for simple communications - short text or brief typed messages.  Even the other two parts can be dropped if the programs are closely monitored, or if errors will not matter very much.

However, it is important to realize that receiving and transmitting data is not always quite as simple as it might appear, especially when you are coding under Windows.  For example, suppose your program is receiving data and saving material to a disk file.  What should happen if more data is received while the program is writing data to disk?  Alternatively, suppose the user presses a key that means "clear the screen and display a menu" while data is being received?

Situations like this are common.  The standard way of handling them is to use a buffer.

 

See Also

Serial Communications