|char TM_FAR * userBufferPtr,|
|char TM_FAR * userDataPtr,|
|cont struct sockaddr TM_FAR * toAddressPtr,|
Allows the user to send data on a socket directly from user owned data buffers without having to copy the data. Upon return from this routine, the user no longer owns its buffer.The only exception is when TM_SOCKET_ERROR is returned and the errorCode retrieved with tfGetSocketError() is TM_EWOULDBLOCK. In that case the user still owns its buffer and should try and re-send the same buffer later on. The userFreeFunction (type ttUserFreeFunc) will be called by the Treck stack for each user buffer if an error other than TM_EWOULDBLOCK occurs, or when the data has been sent out on the network, and the device driver no longer needs to access the data in the user buffer. It is the user's responsibility to ensure that the userFreeFunction is re-entrant as it could potentially be called from different threads, unless the user uses a different free function per user application thread and the user does not use a Treck transmit task and does not use a Treck send (complete) task.
|Note:||An example of tfZeroCopyUserBufferSendTo() usage is shown in the loopback test module txscatlp.c.|
- The socket descriptor to send data to.
- A pointer to the user buffer to be used when calling the userFreeFunction.
- A pointer to the user data.
- The size of the user data.
- The function (type ttUserFreeFunc) called by the stack when the buffer is no longer needed.
- One of the following:
- The address to send the data to.
- The length of the destination address.
- >= 0
- The number of bytes transmitted/queued. Treck will free the user buffers.
|Note:|| TM_SOCKET_ERROR means that this socket call has failed and the errorCode has been set on the socket itself.
To retrieve the socket error the user must call tfGetSocketError(socketDescriptor).
Possible socket errors
- There is not enough room in the socket's send queue to queue the data. The user still owns the user buffer and is responsible for re-sending later on.
- One of the following:
- userBufferPtr is 0.
- userDataPtr is 0.
- userDataLength is 0 or -1.
- userFreeFunction is 0.
- flags is something besides what is listed above.
- Not enough memory to allocate the Treck headers.
- The socket descriptor is invalid.
- The data length was larger than the socket's send queue.
- No route to destination.
- The socket received an ICMP destination unreachable message from the remote host. This typically means that the receiver is not listening on the remote port.