| |

VerySource

 Forgot password?
 Register
Search
View: 1006|Reply: 6

SendRequest function error

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-3 14:30:01
| Show all posts |Read mode
CString strHeaders = _T ("Content-Type: application / x-www-form-urlencoded"); // http protocol
CString strFormData;
strFormData.Format ("UserName =% s, circle);
Ranch
Ranch
CString serverName = _T ("127.0.0.1"); // ip
INTERNET_PORT nPort = 8088; // Port number
CString formAction = _T ("\\web\\Service.jsp");
CInternetSession session;
CHttpConnection * pConnection = session.GetHttpConnection (serverName, nPort);
CHttpFile * pFile = pConnection-> OpenRequest (CHttpConnection :: HTTP_VERB_POST, formAction);

// A fatal error may occur when the server is not open
BOOL result = pFile-> SendRequest (strHeaders, (LPVOID) (LPCTSTR) strFormData, strFormData.GetLength ()); // Send request
Ranch
CString strResult;
pFile-> ReadString (strResult);
strResult.TrimLeft ();
strResult.TrimRight ();
return atoi (strResult);

This code calls pFile-> SendRequest (strHeaders, (LPVOID) (LPCTSTR) strFormData, strFormData.GetLength ()); if the server is not turned on, a fatal error will occur. Ask the expert for a solution to the problem, thank you
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-6-2 22:15:02
| Show all posts
Fatal error?
If it is not open, it should be a failure to send and return 0. .
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-6-3 11:45:04
| Show all posts
I am also getting this one, there will be no fatal errors when using synchronization,
It’s just mine. Sometimes I get stuck when I run SendRequest. I want to use asynchronous, but I ran into it again.
The problem cannot be solved. If you are familiar with it, we can discuss it.
Reply

Use magic Report

0

Threads

10

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-6-12 06:15:01
| Show all posts
Fatal error, what error?
If pFile is not opened by the server, it is NULL, how can it go to SendRequest if the three-way handshake fails. . .
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-7-25 14:30:01
| Show all posts
Is there a way to check whether it is connected to the server?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-27 12:45:02
| Show all posts
I also use sendreqest(). Some machines don’t block, and some are blocked. I don’t know how you guys solve it. Please ask me!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-27 17:45:01
| Show all posts
I am also very concerned about this. Recently I also used this thing to multi-thread the old error
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