|
在vc9下运行下面程序时,运行到else if (oConnector.connect(oPeer, oPeerAddr, &oTimeOut))
有错误,打印的错误码为10093(应用程序没有调用WSAStartup,或者WSAStartup失败),这是ACE书上的例子,不知错在哪里,帮忙看看
#include "stdafx.h"
#include <ace/INET_Addr.h>
#include <ace/SOCK_Connector.h>
#include <ace/SOCK_Stream.h>
#include <ace/Log_Msg.h>
int _tmain(int argc, _TCHAR* argv[])
{
ACE_SOCK_Connector oConnector;
ACE_SOCK_Stream oPeer;
ACE_INET_Addr oPeerAddr;
ACE_Time_Value oTimeOut(10);
if (oPeerAddr.set(8000) == -1)
{
ACE_ERROR_RETURN((LM_ERROR, "%p\n", "set()"), -1);
}
else if (oConnector.connect(oPeer, oPeerAddr, &oTimeOut))
{
int iError = WSAGetLastError();
ACE_ERROR_RETURN((LM_ERROR, "%p\n", "connect()"), -1);
}
} |
|