Author Topic: WinHttp in syncrhonous and asynchronous mode  (Read 269 times)

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
WinHttp in syncrhonous and asynchronous mode
« on: September 06, 2021, 06:09:05 PM »
Hello,
****The synchronous mode is the more easy to code but don't allow
The dowload of big files.
****The asynchronous mode wait that the server is ready to send data.
He allow the download of big files.
He need the safeseh compile option,He need to be thread safe
He need to use Critical Sections in a correct way (enter and leave
the critical sections must be in the same Number).
He need a callback to know when receive data.
The callback give many events and only some of this event allow
actions.they are:
Quote
WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE          WinHttpQueryDataAvailable
WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE       WinHttpReceiveResponse
WINHTTP_CALLBACK_STATUS_READ_COMPLETE           WinHttpReadData
WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE      WinHttpSendRequest
WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE         WinHttpWriteData
WINHTTP_CALLBACK_STATUS_REQUEST_ERROR         Any of the above functions when an error occurs.
The asynchrounous sample give the full set of API error in text
He give also the full set of status states  of the connexion in text.
Because of the safeseh option,you need JWASM to compile it.
It's a console proc,you can use the command line with parameters url beetween " " to use it or use check.bat.
It's a demo program,the dowloaded  files need to be renamed.(.htm,.exe,;jpg ......)

Fa is a musical note to play with CL