Jump to: navigation, search

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.


  • 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.

Note 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

    The socket descriptor is invalid.
    Insufficient memory to complete the operation.
    No route to destination host. (Non-TCP socket only.)
    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.)
    The socket requires that the message be sent atomically and the message was too long.
    The socket is marked as non-blocking and the write operation would block.

Table of Contents >> Programmer's Reference