我正在尝试使用CSmtp发送电子邮件 http://www.codeproject.com/Articles/98355/SMTP-Client-with-SSL-TLS
这些代码行在这里造成了伤害:
inet_addr
gethostbyname
和'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
不再有效了。
inet_pton()
如何使用getaddrinfo()
和$('#selectAgent').typeahead({
source: function (query, process) {
return $.ajax({
url: "/eBus/EbusinessAgentServlet",
data: { query: query },
type: "POST",
async: false,
success: function (data) {
console.log(data)
return process(data);
}
});
},
minLength: 2,
highlighter: formatRecord,
updater: function (item) {
$('#selectAgent').attr('data-agent-id', item.split('#')[1]);
return formatRecord(item);
}
});
将其投放?
我试图找到解决方案,但到目前为止还没找到任何东西......
谢谢!
答案 0 :(得分:0)
我认为它应该是这样的:
#ifdef LINUX
int retVal = inet_pton(AF_INET, czServer, &sockAddr.sin_addr);
#else
int retVal = InetPton(AF_INET, czServer, &sockAddr.sin_addr);
#endif
if(retVal != 1)
{
struct addrinfo *result = NULL;
struct addrinfo hints;
#ifdef LINUX
memset(&hints, 0, sizeof(struct addrinfo));
#else
ZeroMemory( &hints, sizeof(hints) );
#endif
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC;
getaddrinfo(argv[1], NULL, &hints, &result);
if (host)
memcpy(&sockAddr.sin_addr,result->ai_addr,result->ai_addrlen);
freeaddrinfo(result);
else
{
#ifdef LINUX
close(hSocket);
#else
closesocket(hSocket);
#endif
throw ECSmtp(ECSmtp::WSA_GETHOSTBY_NAME_ADDR);
}
}
基于:
视窗:
Linux的: