COMM-DRV/Lib: ModemWaitforConnect() Effects an abortable modem connection

Description-

This functions waits for a call, answers the phone, and returns when two modems have successfully connected. This function can be aborted from another thread or event by issuing the CdrvAbort().

Syntax-

stat = ModemWaitForConnect(Port,RingCount,Mode);

On Entry-

int port;

Port previously opened with InitializePort() or OpenComPort().

int RingCount;

Number of rings before answering the phone.

int Mode;

0 Puts modem in auto answer mode to answer on specified ring count. Determines connect based on receiving the string “CONNECT” or the string specified as being the connect string.

1 The modem is set to non auto answer mode. The stream is scanned for the string “RING” or the string specified as being the ring string. Determines connect based on receiving the string “CONNECT” or the string specified as being the connect string.

On Exit-

int stat;

0 If the modem is connected to another modem.

-1 If a hardware error or modem error has occurred.

2 Aborted.

See Also-

ModemWaitForCall()

Example-

#include "comm.h"
main()
 {
 int Port=0;
 int RingCount=1;
 int Mode=0;
 int stat;
if ((stat = ModemWaitForConnect(Port,RingCount,Mode)) < 0) 
printf("Modem or hardware error has occurred\n"); 
else if (stat > 0)
 printf("Application programmer aborted function\n");
else
 printf("Modems are connected\n");
 :
 :
 }