This is what we had to say about it in MegaFox: 1002 Things You Wanted to Know About Extending VFP:
• User Datagram Protocol (UDP) A connectionless protocol (analogous to passing a note) under which data is passed from one ‘peer’ computer to another without the need to establish an explicit connection.
• Transmission Control Protocol (TCP) A connection based protocol (analogous to a telephone call) which requires that a connection be explicitly established between one computer acting as the ‘client’ and another computer acting as the ‘host’.
So which protocol is best?
The answer, as so often in VFP, is that it depends. Each protocol has its benefits, and its drawbacks. Table 9.12 gives a side-by-side comparison.
Table 9.12: Features of the protocols available to the winsock control
UDP TCP
No connection required. Participating computers are equivalent to each other and each binds to the remote port of its peer Explicit connection required. One participant (the ‘host’) must have an active listener so that a client can establish a connection
Data must be transmitted in a single send operation. Maximum size is determined by the network set up and excess data is simply lost. Data can be transmitted using multiple send operations. Maximum size is not dependent upon network configuration
A single socket can switch between partners without needing to reset A single socket can only handle one connection at a time. Therefore to change partners any existing connection must be closed before another can be established
No acknowledgements Explicit connection allows query/acknowledgement to control communication
No connection and no integrity checking Connection is managed and data integrity ensured
Lower resource requirement, unreliable Higher resource requirement, reliable
It is apparent from the above table that the UDP protocol is better suited to applications that either involve manual intervention (e.g. Instant Messaging) or are simply broadcast without requiring any acknowledgement. Conversely, TCP is a better choice when an automated process is required (e.g. Error Reporting) or when any form of exchange is required.
Marcia G. Akins