tfDialerAddExpectSend

Jump to: navigation, search

Table of Contents >> Optional Protocols >> Dialer


#include <trsocket.h>


int tfDialerAddExpectSend (
ttUserInterface interfaceId,
char * sendString,
char * expectString,
char * errorString,
int numRetries,
int timeout,
unsigned char flags
);


Function Description

This function adds an expect-send pair to the dialer (client waits for the server to send a string, and then sends a string in response). When the dialer reaches this phase, it waits for the remote host to send a string. If this string matches 'expectString', 'sendString' is sent back in response and the dialer moves to the next state. If the received string matches 'errorString', this phase is aborted, and if TM_DIALER_FAIL_ON_ERROR is set in 'flags', the entire dialing session is terminated with an error.

The dialer will wait for 'expectString' or 'errorString' for a time equal to 'timeout' in seconds. If the number of retries specified by 'numRetries' has not been exhausted when this time elapses, the dialer will begin waiting again. When the retry limit has been reached, the dialer will abort the session and return with an error.


Parameters

  • interfaceId
    The interface handle used in the previous call to tfUseDialer(). This parameter specifies the device to dial upon.
  • sendString
    The string to send when the 'expectString' is received from the peer.
  • expectString
    The string to send to the peer immediately.
  • errorString
    The string that, if received from the peer, indicates an error.
  • numRetries
    The number of times to attempt to resend 'sendString' before failing.
  • timeout
    The amount of time (in seconds) between timeouts.
  • flags
    0 or TM_DIALER_FAIL_ON_ERROR. If set to TM_DIALER_FAIL_ON_ERROR, the dialer will return immediately if the error string is received. Normally the dialer would simply attempt to resend the previous string.


Returns

  • TM_ENOERROR
    Success.
  • TM_EINVAL
    One of the parameters is incorrect or the 'timeout' value is 0.
  • TM_ENOMEM
    Insufficient memory to add the 'expectString' or 'sendString'.


Table of Contents >> Optional Protocols >> Dialer