|
发表于 2004-3-25 13:58:45
|
显示全部楼层
我在uclinux 2.0.38下使用的是smtpclient. 一切都很正常, 你不妨可以試試.
static int mailport = 25;
/*
* Connect to smtp daemon on mailhost.
*/
memset((char *)&sin, 0, sizeof(sin));
if(!inet_aton(mailhost, &sin.sin_addr))
{
if ((hp = gethostbyname(mailhost)) == NULL) {
log("%s: unknown host\n", mailhost);
exit(1);
}
if (hp->h_addrtype != AF_INET) {
log("unknown address family: %d", hp->h_addrtype);
exit(1);
}
memcpy((char *)&sin.sin_addr, hp->h_addr, hp->h_length);
}
sin.sin_family = AF_INET;
sin.sin_port = htons(mailport); |
|