С++, Embarcadero RAD Studio XE2
我需要通过 http-proxy 使用 TIdTCPClient 连接到 ::6100。所以我写了这段代码:
m_pClient = new TIdTCPClient( NULL );
m_pClient->Host = m_sServerAddress.c_str();
m_pClient->Port = StrToInt( m_sServerPort.c_str() );
m_pClient->ConnectTimeout = 5000;
m_pClient->ReadTimeout = 5000;
if ( m_bUseProxy == true )
{
m_pIdIOHandlerStack = new TIdIOHandlerStack( NULL );
m_pIdIOHandlerStack->TransparentProxy = new TIdConnectThroughHttpProxy( m_pIdIOHandlerStack );
m_pIdIOHandlerStack->TransparentProxy->Host = m_sProxyHost;
m_pIdIOHandlerStack->TransparentProxy->Port = m_iProxyPort;
m_pIdIOHandlerStack->TransparentProxy->Enabled = True;
m_pClient->IOHandler = m_pIdIOHandlerStack;
}
else
{
m_pClient->IOHandler = NULL;
}
<other code>
m_pClient->Connect();
我在“连接”代理上得到了一个例外“403 禁止”:5.196.0.118::3128
我可以在没有代理或 ping 它的情况下连接到该服务器。我在浏览器上成功使用了这个代理服务器,但我不能将它用于我的代码。我该如何解决这个问题?