tfWrite
Table of Contents >> Programmer's Reference
#include <trsocket.h> |
int tfWrite | ( |
int socketDescriptor, | |
char * bufferPtr, | |
int bufferLength | |
); |
Function Description
tfWrite() is used to transmit a message to another transport end-point. It is not called write to avoid confusion with an embedded kernel file system call. It operates identically to send(), except that it does not have any flags parameter, and hence does not support sending out-of-band data, or overwriting the blocking state of the socket for the duration of the call.
Parameters
- socketDescriptor
- The socket descriptor to receive data from.
- bufferPtr
- The buffer to send.
- bufferLength
- The length of the buffer to send.
Return Values
- >= 0
- The number of bytes actually sent on the socket.
- TM_SOCKET_ERROR
- Failure.
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
- TM_EBADF
- The socket descriptor is invalid.
- TM_ENOBUFS
- Insufficient memory to complete the operation.
- TM_EHOSTUNREACH
- No route to destination host. (Non-TCP socket only.)
- TM_ECONNREFUSED
- 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. (For non-TCP sockets.)
- TM_EMSGSIZE
- The socket requires that the message be sent atomically and the message was too long.
- TM_EWOULDBLOCK
- The socket is marked as non-blocking and the write operation would block.