Important: The information in this document is obsolete and should not be used for new development.
EWrite
TheEWrite
function allows you to send data directly to a hardware device driver for a particular network type for transmission across the network.
FUNCTION EWrite (thePBptr: EParamBlkPtr; async: Boolean): OSErr;
thePBptr
- A pointer to a parameter block of type
EParamBlock
.async
- A Boolean value that specifies whether the function should be executed asynchronously or synchronously. Specify
TRUE
for asynchronous execution.
--> ioCompletion ProcPtr A pointer to completion routine. <-- ioResult OSErr The result code. --> ioRefNum Integer The driver reference number. --> csCode Integer Always ENetWrite
for this function.--> ePointer Ptr A pointer to write-data structure.
Field Description
ePointer
- A pointer to the write-data structure that contains the data that you want to send.
DESCRIPTION
You use theEWrite
function to send a data packet over an Ethernet, a token ring, or an FDDI network by communicating directly with the hardware device driver for that network type. You must first prepare a write-data structure that specifies the destination address and the protocol type and contains the data that you want to send. You place a pointer to the write-data structure in theePointer
parameter.For Ethernet, if you want to send a packet larger than 768 bytes, you must first call
theESetGeneral
function to put the .ENET driver in general-transmission mode.
If the size of the packet you provide is less than 60 bytes, the driver adds pad bytes to
the packet.TOKEN RING AND FDDI CONSIDERATIONS
You can use this function to send data to a token ring or FDDI driver. Note that the packet size for token ring and FDDI is hardware dependent. However, for Logical Link Control (LLC) type packets, the packet length cannot exceed 1500 bytes.To use this function for token ring or FDDI, you must set the
ioRefNum
field to the driver reference number that theOpenSlot
orOpenDriver
function returns.You must also provide a pointer to a write-data structure. The first buffer in the write-
data structure must be at least 14 bytes long: the first 6 bytes of that buffer must contain the destination address. Bytes 13 and 14 must contain the packet length, which must not exceed 1500 bytes. The token ring driver fills in bytes 7-12 with the source address.ASSEMBLY-LANGUAGE INFORMATION
To execute theEWrite
function from assembly language, call the_Control
trap macro with a value ofENetWrite
in thecsCode
field of the parameter block. To execute the_Control
trap asynchronously, include the value,ASYNC
in the operand field.RESULT CODES
noErr 0 No error eLenErr -92 Packet too large or first entry of the write-data structure
did not contain the full 14-byte headerexcessCollsns -95 Hardware error SEE ALSO
For information on how to use theEWrite
function and how to create a write-data structure, see "Using a Write-Data Structure to Transmit Ethernet Data" beginning on page 11-10.