Important: The information in this document is obsolete and should not be used for new development.
PWriteDDP
ThePWriteDDPfunction sends a DDP datagram to another socket.
FUNCTION PWriteDDP (thePBptr: MPPPBPtr; async: Boolean): OSErr;
thePBptr- A pointer to an MPP parameter block.
async- A Boolean that specifies whether the function should be executed asynchronously. Specify
TRUEfor asynchronous execution.
--> ioCompletion ProcPtr A completion routine. <-- ioResult OSErr The result code. --> csCode Integer Always writeDDPfor this function.--> socket Byte The number of socket to send data from. --> checksumFlag Byte The checksum flag; nonzero to
compute checksum.--> wdsPointer Ptr A pointer to write-data structure.
Field Description
socket- The number of the socket from which you want to send data. See the description of the
POpenSktfunction for information on the assignment of socket numbers.checksumFlag- The checksum flag. If you set this field to a nonzero value and if DDP uses a long header for the datagram (that is, if the destination socket has a network number different from that of the source socket), then the
PWriteDDPfunction calculates a checksum for the datagram and includes it in the datagram header. Set this field to 0 if you do not want thePWriteDDPfunction to calculate a checksum.wdsPointer- A pointer to a write-data structure. The write-data structure provides the destination address and the data for the datagram.
The DDP write-data structure is described in "Creating a DDP Write-Data Structure" on page 7-12.DESCRIPTION
Before you call thePWriteDDPfunction, you must prepare a write-data structure.
The write-data structure, shown in Figure 7-4 on page 7-13, includes a pointer to the destination address and pointers to buffers containing the data you wish to send.
You can use theBuildDDPwdsprocedure to build a write-data structure.Set the checksum flag field when you call the
PWriteDDPfunction to have the function calculate the checksum and include it in the packet header. Note, however, that only
long packet headers include a checksum field, and that whether the checksum is used
for error checking depends on how the socket listener code at the destination socket is implemented.The
PWriteDDPfunction is equivalent to calling thePBControlfunction with a value ofwriteDDPin thecsCodefield of the parameter block.SPECIAL CONSIDERATIONS
Memory used for the write-data structure belongs to DDP and must be nonrelocatable until thePWriteDDPfunction completes execution, after which you can either reuse the memory or release it.ASSEMBLY-LANGUAGE INFORMATION
To execute thePWriteDDPfunction from assembly language, call the_Controltrap macro with a value ofwriteDDPin thecsCodefield of the parameter block. You must also specify the .MPP driver reference number. To execute the_Controltrap asynchro-
nously, include the value,ASYNCin the operand field.RESULT CODES
noErr 0 No error ddpSktErr -91 Bad socket number ddpLenErr -92 Datagram data exceeds 586 bytes noBridgeErr -93 Could not find router to forward packet SEE ALSO
For a description of the DDP write-data structure, see "Creating a DDP Write-Data Structure" on page 7-12.If you are programming in Pascal or C, see the description of the
BuildDDPwdsprocedure that follows for help in creating a write-data structure.