tfBlockingState

Jump to: navigation, search

Table of Contents >> Programmer's Reference


#include <trsocket.h>


int tfBlockingState (
int socketDescriptor,
int blockingState
);


Function Description

This function is used to set blocking or non-blocking on a socket as the default mode of operation. This can be overridden with the MSG_DONTWAIT flags on subsequent calls. The tfIoctl() call with the FIONBIO request can be used instead of the tfBlockingState() call.


Parameters

  • socketDescriptor
    The socket descriptor to set the blocking/non-blocking flag on.
  • blockingState
    One of the following:
  • TM_BLOCKING_OFF
  • TM_BLOCKING_ON


Returns

  • TM_ENOERROR
    Success
  • TM_SOCKET_ERROR
    Failure


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

  • TM_EBADF
    'socketDescriptor' is not a valid descriptor.
  • TM_EINVAL
    'blockingState' is not valid.


Table of Contents >> Programmer's Reference