I’ve configured autoconnect to connect a modem automatically on socket calls (Siemens GPRS modem on serial port). The autoconnect works fine and starts pppd and my connection is made . My chat file, autoconnect file and example source code are shown below.
However, on the socket call that actually initiates the autoconnect (whan I’m presently unconnected and pppd is not running) - in this case the initiating call is gethostbyname() - this function blocks and does not return (until after a long system-defined timeout of several minutes). So, the autoconnect is actually initiating and completing - within about 12 seconds of the gethostbyname() call - I can see this with an ifconfig utility call on a terminal - but gethostbyname() is stuck. If I stop the program and start it then it works quite happily since the connection is already made.
Any ideas? I’ll look for some other calls to make that can also lead to autoconnect and test those when I’m next near my QNX machine.
Thanks
Pete
/etc/chat file:
“” ATZ
ABORT BUSY ABORT ‘NO DIALTONE’ ABORT ‘NO CARRIER’ ABORT ERROR OK ATM0
ABORT BUSY ABORT ‘NO DIALTONE’ ABORT ‘NO CARRIER’ ABORT ERROR OK at+cgdcont=1,ip,internet
ABORT BUSY ABORT ‘NO DIALTONE’ ABORT ‘NO CARRIER’ ABORT ERROR OK ATDT99**1#
ABORT BUSY ABORT ‘NO DIALTONE’ ABORT ‘NO CARRIER’ ABORT ERROR CONNECT “”
autoconnect script file:
pppd connect “chat -v -f /etc/chat” debug defaultroute resconf require-ns updetach noipdefault logstatus /dev/ser1 name web
exit
example application code:
int fd;
struct sockaddr_in addr;
struct hostent *hent;
fd = socket(AF_INET, SOCK_STREAM, 0);
if(fd == -1)
{
… errorstuff
return - 1 ;
}
hent = gethostbyname(hname); /* blocks here on autoconnect */