Jump to: navigation, search

Table of Contents >> Programmer's Reference

#include <trsocket.h>

int tfSendToFromInterface (
int socketDescriptor,
const char * bufferPtr,
int bufferLength,
int flags,
const struct sockaddr * toAddressPtr,
int addressLength,
const struct sockaddr * fromAddressPtr,
const ttUser8BitPtr toPhyAddrPtr,
int toPhyAddrLen,
ttUserInterface interfaceHandle,
unsigned int mhomeIndex

Function Description

Same as tfSendToFrom(), but takes 4 extra parameters to let the user specify the link layer destination address, and the interface to send the data through.


  • socketDescriptor
    The socket descriptor to use to send the data.
  • bufferPtr
    The buffer to send.
  • bufferLength
    The length of the buffer to send.
  • flags
    MSG_DONTWAIT: Don't wait for room in the socket send queue.
    0: Wait for room in the socket send queue.
  • toAddressPtr
    The address to send the data to.
  • addressLength
    The length of the area pointed to by toAddressPtr or fromAddressPtr.
  • fromAddressPtr
    The address to send the data from.
  • toPhyAddrPtr
    Destination link layer address.
  • toPhyAddrLen
    Destination link layer address length.
  • interfaceHandle
    Interface to send the data through as returned by tfAddInterface().
  • mhomeIndex
    Multihome index on the interface.


  • >= 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.
    A parameter is invalid.
    Insufficient memory to complete the operation.
    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.
    The message was too long.
    The TCP protocol requires usage of send() not tfSendToFromInterface().
    The socket is marked as non-blocking and the tfSendToFromInterface() operation would block.

Table of Contents >> Programmer's Reference