Link to home
Start Free TrialLog in
Avatar of appforce
appforce

asked on

How to disconnect (using CInternetSession, ChttpConnection, Chttpfile)

Hello! I wanna develop a Http client program! I use three classes (CInternetSession, ChttpConnection, Chttpfile) for doing this! Now I can connect to my web LAN server, send request, and get the response. However, when it finished, I use functions Chttpfile::Close() ChttpConnection::Close(), and CInternetSession::Close() to disconnect to the server. But It doesn't work at all. I also "delete" theses three classes. But the connection still exists until the server disconnect this connection, or I shutdown the program. Is there any solution to disconnect it? Thank you very much!
ASKER CERTIFIED SOLUTION
Avatar of WKalata
WKalata

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of appforce
appforce

ASKER

Thank you for the answer! Sir! However, I tried the try & catch before, and it didn't catch any exception. I also calling Close on all three of them before I delete them. And I also use the callback function of the CInternetsession function. But it seems that the it never send the status of connection closed. It just seems that MFC doesn't implement the Close() function! Anyways, I am quite appreicating your answer! Thank you very much!