I'm trying to connect to the yahoo smtp server so that i can pass emails but
I can't seem to connect. I use a treo 650, can anyone look at the following
code to see what's wrong??
NetHostInfoBufPtr hostInfoBufP = NULL;
NetHostInfoPtr hostInfoP = NULL;
NetIPAddr address = 0;
NetIPAddr *addressP = NULL;
NetServInfoBufPtr servInfoBufP = NULL;
NetServInfoPtr servInfoP = NULL;
UInt16 port = 0;
UInt16 *portP = NULL;
NetSocketRef sockRef;
NetSocketAddrINType inetAddrP;
Int16 results;
errno = NetLibOpen(gNetRefNum, &ifErrs);
if (!errno){
hostInfoBufP = (NetHostInfoBufPtr) MemPtrNew
(sizeof(NetHostInfoBufType));
hostInfoP = NetLibGetHostByName(gNetRefNum, "mail.yahoo.com",
hostInfoBufP, 120 * SysTicksPerSecond(), &ifErrs);
if (hostInfoP != 0){
addressP = (NetIPAddr*) hostInfoP->addrListP[0];
address = NetNToHL(*addressP);
}
servInfoBufP = (NetServInfoBufPtr) MemPtrNew
(sizeof(NetServInfoBufType));
servInfoP = NetLibGetServByName (gNetRefNum, "smtp", "tcp",
servInfoBufP, 60 * SysTicksPerSecond(), &ifErrs);
if (servInfoP!=0){
port = servInfoP->port;
}
sockRef = NetLibSocketOpen(gNetRefNum, netSocketAddrINET,
netSocketTypeStream, 0, 60 * SysTicksPerSecond(), &ifErrs);
if (sockRef!= 0){
inetAddrP.family = netSocketAddrINET;
inetAddrP.port = NetHToNS(port);
inetAddrP.addr = NetHToNL(address);
FrmAlert(noAnswer);
}
results = NetLibSocketConnect(gNetRefNum, sockRef, (NetSocketAddrType *)
&inetAddrP, sizeof(inetAddrP), 60 * SysTicksPerSecond(), &ifErrs);
if (results == 0)
FrmAlert(resAlertPhoneLibrary);
else {
if (ifErrs == 0)
FrmAlert(err16);
else if (ifErrs == netErrTimeout)
FrmAlert(err1);
}
For some reason I keep getting netErrTimeout. But even if I changed the
timeout to be 5 minutes it's still timing out....anyone know what I'm doing
wrong?
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/