Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Networking /


Chapter 7 - Datagram Delivery Protocol (DDP)

This chapter describes how you can use the Datagram Delivery Protocol (DDP) to send data to and receive it from another socket across an AppleTalk internet. To use DDP, you send and receive data as discrete packets, each packet carrying its own addressing information. DDP does not allow you to set up a connection between two sockets, nor does DDP ensure that data is delivered error free as do some of the AppleTalk protocols that are built on top of it.

You should use DDP if your application does not require reliable delivery of data and you do not want to incur the additional processing associated with the use of a protocol that entails setting up and breaking down a connection. Because it is connectionless
and does not include reliability services, DDP offers faster performance than do the higher-level protocols that add these services. Applications such as diagnostic tools that retransmit packets at regular intervals to estimate averages or games that can tolerate packet loss are good candidates for the use of DDP.

A series of DDP packets transmitted over an AppleTalk internet from one node to another may traverse a single high-speed EtherTalk network or they may wind across multiple intermediate data links such as LocalTalk or TokenTalk, which are connected
by routers. During the course of this process, some packet loss can occur, for example,
as a result of collisions. If you do not plan on implementing recovery from packet loss
in your application, but your application requires it, you should consider using an AppleTalk transport protocol, such as the AppleTalk Data Stream Protocol (ADSP) or
the AppleTalk Transaction Protocol (ATP); these protocols protect against packet loss
and ensure reliability by using positive acknowledgment with packet retransmission mechanisms.

This chapter describes how to

This chapter includes a sample socket listener that you can use as a model for your own socket listener or modify to fit your application's requirements.

For an overview of DDP and how it fits within the AppleTalk protocol stack, read the chapter "Introduction to AppleTalk" in this book, which also introduces and defines some of the terminology used in this chapter.

For an explanation of the DDP specification, see Inside AppleTalk, second edition.


Chapter Contents
About DDP
About Sockets and Socket Listeners
Assigning Socket Numbers
DDP Client Protocol Types
Obtaining Data From the Network
Using DDP
Sending and Receiving Data: An Overview
Opening a Socket
Sending Data
Receiving Data
Creating a DDP Write-Data Structure
Using Registers and Packet Headers
How the .MPP Driver Calls Your Socket Listener
The DDP Packet and Frame Headers
The MPW Equates
Reading an Incoming Packet
Using Checksums
A Sample Socket Listener
Socket Listener Queues and Buffers
Setting Up the Socket Listener
Initializing the Socket Listener
Processing a Packet
Testing for Available Packets
Measuring Packet-Delivery Performance
DDP Reference
Data Structures
The Write-Data Structure
The Address Block Record
MPP Parameter Block
Routines
Opening and Closing DDP Sockets
Sending DDP Datagrams
Summary of DDP
Pascal Summary
Constants
Data Types
The Write-Data Structure
The Address Block Record
MPP Parameter Block
Routines
Opening and Closing DDP Sockets
Sending DDP Datagrams
C Summary
Constants
Data Types
The Write-Data Structure
The Address Block Record
MPP Parameter Block
Routines
Opening and Closing DDP Sockets
Sending DDP Datagrams
Assembly-Language Summary
Constants
Data Structures
MPP Parameter Block Common Fields for DDP Routines
OpenSkt Parameter Variant
CloseSkt Parameter Variant
WriteDDP Parameter Variant
Result Codes

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996