| |

VerySource

 Forgot password?
 Register
Search
View: 830|Reply: 2

Anxious! Anxious! Anxious! The TCP connection established cannot be closed ?????????????

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-6 17:00:01
| Show all posts |Read mode
// The function of my program is to download a file from the website
I use the following two APIs to achieve this function:

m_hHTTP = InternetOpen (NULL, INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY, NULL, NULL, 0);

m_hServerFast = InternetOpenUrl (m_hHTTP, lpServer, szHead, lstrlenA (szHead), INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_RELOAD, 0);

But when I call the following API to close the handle, the TCP connection established by the execution of the above function
It is not closed, and the TCP connection is in the Closed state.
InternetCloseHandle (m_hServerFast);
InternetCloseHandle (m_hHTTP);

Ask a master to help analyze whether the TCP connection opened by InternetOpenUrl needs other APIs to close it.
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-7-24 11:15:01
| Show all posts
You have to give it time to close!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-2 06:00:01
| Show all posts
CInternetSession ses;
CInternetFile *f=NULL;
f=(CInternetFile*)ses.OpenURL(site);
Delete f at the end;
I don't know if it's right, just take a look.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list