Discussion:
HTTP/HTTPS connection
(too old to reply)
Petar Popara
2006-01-12 14:09:08 UTC
Permalink
I'm using following WinINET functions:

InternetOpen()
InternetConnect()
HttpOpenRequest()
HttpAddRequestHeaders()
---------------------------------
HttpSendRequestEx()
InternetWriteFile()
HttpEndRequest()
InternetReadFile()

I execute first group of functions to get request handle and then I execute
second group of functions several times. The problem is that I don't close
(destroy) request/connection handle for a long time and connection might be
lost whwn I execute second group of function again (after several
minutes/hours/days). How can I find out if connection/request handles are
invalid to make a connection once again?
Scherbina Vladimir
2006-01-12 14:25:17 UTC
Permalink
Post by Petar Popara
InternetOpen()
InternetConnect()
HttpOpenRequest()
HttpAddRequestHeaders()
---------------------------------
HttpSendRequestEx()
InternetWriteFile()
HttpEndRequest()
InternetReadFile()
I execute first group of functions to get request handle and then I
execute second group of functions several times. The problem is that I
don't close (destroy) request/connection handle for a long time and
connection might be lost whwn I execute second group of function again
(after several minutes/hours/days). How can I find out if
connection/request handles are invalid to make a connection once again?
Only by checking return values of functions of second group. Maybe you
should review your approach, because server might break connection at any
moment, and you cannot rely on it.

--
Vladimir
Petar Popara
2006-01-13 07:50:34 UTC
Permalink
Post by Scherbina Vladimir
Only by checking return values of functions of second group.
If function fails, it returns "Invalid Handle" (GetLastError() == 6)? Can it
return some other value in this case?
Scherbina Vladimir
2006-01-13 13:30:22 UTC
Permalink
- HttpSendRequestEx returnes FALSE on error with a big delay, so in order to
overcome this delay you may use async. approach.
- InternetWriteFile returnes FALSE.
- HttpEndRequest returnes FALSE.
- InternetReadFile returnes FALSE.
Post by Petar Popara
Post by Scherbina Vladimir
Only by checking return values of functions of second group.
If function fails, it returns "Invalid Handle" (GetLastError() == 6)? Can
it return some other value in this case?
in case when there will be another problem (for example, not enought
resources) you will get another error code.

--
Vladimir

Continue reading on narkive:
Loading...