tfDialerAddSendExpect

Jump to: navigation, search

Table of Contents >> Optional Protocols >> Dialer


#include <trsocket.h>


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


Function Description

This function adds a send-expect pair to the dialer (local peer sends a string and waits for the remote peer to respond). When the dialer reaches this phase, it will send 'sendString' to the remote peer and waits for its response. If this response matches 'expectString', the dialer successfully moves to the next state. However, if the received string matches 'errorString' the dialer will abort this phase, and if TM_DIALER_FAIL_ON_ERROR is set in flags the entire dialing session will be aborted with an error.

After sending 'sendString', the dialer will wait 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 resend 'sendString' and repeat this process. 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