Hello,
I am not sure whether 100% CPU usage is component originated but sometimes
the below code does not timeout:
sendStream = new TMemoryStream();
receivedStream = new TMemoryStream();
HTTPClient = new TSslHttpCli(NULL);
sslContext = new TSslContext(NULL);
HTTPClient->Connection = "close";
HTTPClient->Timeout = 60;
HTTPClient->SslContext = sslContext;
HTTPClient->SslContext->InitContext();
HTTPClient->SendStream = sendStream;
HTTPClient->RcvdStream = receivedStream;
HTTPClient->OnRequestDone = RequestDone;
void __fastcall SendPOST(const String &URL, TMemoryStream *sendStream)
{
receivedStream->Clear();
HTTPClient->URL = URL;
HTTPClient->SendStream = sendStream;
reallyDone = false;
try
{
HTTPClient->PostASync(); // async
while(!reallyDone)
Forms::Application->ProcessMessages();
}
catch(Exception &e)
{
}
}
void __fastcall RequestDone(TObject *Sender, THttpRequest RqType, WORD
ErrCode)
{
delete HTTPClient->SendStream;
HTTPClient->SendStream = NULL;
PostMessage(HandleToPost, WM_ADMIN_HTTP_POST_DONE, ErrCode, 0);
}
void __fastcall finalizeRequest(WORD ErrCode)
{
if(ErrCode)
adminClient->HTTPClientHostUnreachable(ErrCode);
else if(HTTPClient->StatusCode != 200)
adminClient->HTTPClientOnHTTPError();
else
adminClient->HTTPClientDone(receivedStream);
reallyDone = true;
}
void __fastcall TPanteraGUIMainForm::WndProc(TMessage &Message)
{
...
else if(Message.Msg == WM_ADMIN_HTTP_POST_DONE)
{
adminClient->HTTPClient->finalizeRequest(Message.WParam);
}
else
...
}
I really hope somebody has an answer to this. Also one other issue I asked
here before: When used with HTTPS, it sometimes returns 10053.
Regards,
SubZero
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be