Important: The information in this document is obsolete and should not be used for new development.
PWriteDDP
ThePWriteDDP
function 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
TRUE
for asynchronous execution.
--> ioCompletion ProcPtr A completion routine. <-- ioResult OSErr The result code. --> csCode Integer Always writeDDP
for 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
POpenSkt
function 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
PWriteDDP
function calculates a checksum for the datagram and includes it in the datagram header. Set this field to 0 if you do not want thePWriteDDP
function 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 thePWriteDDP
function, 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 theBuildDDPwds
procedure to build a write-data structure.Set the checksum flag field when you call the
PWriteDDP
function 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
PWriteDDP
function is equivalent to calling thePBControl
function with a value ofwriteDDP
in thecsCode
field of the parameter block.SPECIAL CONSIDERATIONS
Memory used for the write-data structure belongs to DDP and must be nonrelocatable until thePWriteDDP
function completes execution, after which you can either reuse the memory or release it.ASSEMBLY-LANGUAGE INFORMATION
To execute thePWriteDDP
function from assembly language, call the_Control
trap macro with a value ofwriteDDP
in thecsCode
field of the parameter block. You must also specify the .MPP driver reference number. To execute the_Control
trap asynchro-
nously, include the value,ASYNC
in 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
BuildDDPwds
procedure that follows for help in creating a write-data structure.