Share via


Asynchronous Network I/O (Windows Embedded CE 6.0)

1/6/2010

Because of the latency inherent in some network operations, many of the upper-edge functions provided by a NIC driver and the lower-edge functions of a protocol driver are designed to support asynchronous operation. Rather than wasting CPU cycles waiting in a loop for a task to finish or a hardware event to signal, network drivers handle most operations asynchronously.

Using a completion function supports asynchronous network I/O. For example, when a protocol driver calls NDIS to send a packet, it results in a call to the NIC driver's MiniportSend function. The NIC driver can try to complete this request immediately and return an appropriate status value as a result. For synchronous operation, the possible responses are NDIS_STATUS_SUCCESS to indicate successful completion of the send, NDIS_STATUS_RESOURCES, and NDIS_STATUS_FAILURE to indicate failure.

A send operation can take some time to complete while the NIC driver or NDIS queues the packet and waits for the NIC to indicate the result of the send operation. The NIC driver MiniportSend function can handle a send operation asynchronously by returning a status value of NDIS_STATUS_PENDING. When the NIC driver completes the send operation, it calls the NdisMSendComplete completion function, passing a pointer to the packet descriptor that was sent. This information is passed to the protocol driver, signaling completion.

If a driver operation requires extended time to complete, the driver typically supports asynchronous operation with a similar completion function. These function names have the following format: NdisMXXXComplete. Along with the send and receive functions, completion functions are available for setting and querying a network configuration, resetting hardware, indicating status, indicating received data, and transferring received data.

See Also

Reference

MiniportSend
NdisMEthIndicateReceiveComplete
NdisMIndicateStatusComplete
NdisMQueryInformationComplete
NdisMResetComplete
NdisMSendComplete
NdisMSetInformationComplete
NdisMTransferDataComplete
NdisMTrIndicateReceiveComplete
NdisMWanIndicateReceiveComplete
NdisMWanSendComplete

Concepts

Network Driver Programming Considerations