Click here to Skip to main content
15,890,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalcheck if PC connects to the internet Pin
includeh1015-Feb-05 5:49
includeh1015-Feb-05 5:49 
GeneralRe: check if PC connects to the internet Pin
Ravi Bhavnani15-Feb-05 8:58
professionalRavi Bhavnani15-Feb-05 8:58 
GeneralRe: check if PC connects to the internet Pin
David Crow15-Feb-05 10:57
David Crow15-Feb-05 10:57 
GeneralRe: check if PC connects to the internet Pin
includeh1015-Feb-05 22:48
includeh1015-Feb-05 22:48 
QuestionWinSOCK and HTTP POST - how to send/receive data? Pin
Peter Laursen15-Feb-05 5:08
Peter Laursen15-Feb-05 5:08 
AnswerRe: WinSOCK and HTTP POST - how to send/receive data? Pin
Ravi Bhavnani15-Feb-05 9:01
professionalRavi Bhavnani15-Feb-05 9:01 
GeneralRe: WinSOCK and HTTP POST - how to send/receive data? Pin
humps15-Feb-05 9:44
humps15-Feb-05 9:44 
GeneralRe: WinSOCK and HTTP POST - how to send/receive data? Pin
Peter Laursen16-Feb-05 0:05
Peter Laursen16-Feb-05 0:05 
Thanks for the replies, all of you.
Neil, your headers worked beautifully if I sent them as-is. However, whenever I try to do something complicated like asking the user to type in his name and then change the Content-Length parameter accordingly, the server sends back a 0...
Here is the new snippet I have been adding:
connect(MySocket, (struct sockaddr*)&Server, sizeof(struct sockaddr));
string Send("POST /Test.php HTTP/1.1\r\nHost: tdlgames.com:80\r\nUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)\r\nAccept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\nAccept-Language: en-us,en;q=0.5\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nKeep-Alive: 300\r\nConnection: keep-alive\r\nContent-Type: application/x-www-form-urlencoded\r\n");
cout << "Enter your name: ";
string Name;
getline(cin, Name);
char Content[100];
sprintf(Content, "Content-Length: %d\r\n\r\n", Name.length());
Send += Content;
Send += "Name=";
Send += Name;
send(MySocket, Send.c_str(), Send.length(), 0);
...

The receive code has not changed. Please help me a bit more - I am grateful for all the answers.
Thank you,
Peter.


Visit
http://www.tdlsoftware.com
GeneralRe: WinSOCK and HTTP POST - how to send/receive data? Pin
humps16-Feb-05 9:09
humps16-Feb-05 9:09 
General#include &amp; Enviornment variables Pin
BlueCrack15-Feb-05 5:04
BlueCrack15-Feb-05 5:04 
GeneralHelp changing the position of the text cursor in an edit box Pin
Bi0Mutati0n15-Feb-05 5:01
Bi0Mutati0n15-Feb-05 5:01 
GeneralRe: Help changing the position of the text cursor in an edit box Pin
basementman15-Feb-05 5:38
basementman15-Feb-05 5:38 
GeneralRe: Help changing the position of the text cursor in an edit box Pin
Bi0Mutati0n15-Feb-05 6:04
Bi0Mutati0n15-Feb-05 6:04 
GeneralRe: Help changing the position of the text cursor in an edit box Pin
Blake Miller15-Feb-05 6:19
Blake Miller15-Feb-05 6:19 
Generalauto login website Pin
ThinkingPrometheus15-Feb-05 3:50
ThinkingPrometheus15-Feb-05 3:50 
GeneralRe: auto login website Pin
Ravi Bhavnani15-Feb-05 9:05
professionalRavi Bhavnani15-Feb-05 9:05 
GeneralRe: auto login website Pin
ThinkingPrometheus15-Feb-05 20:09
ThinkingPrometheus15-Feb-05 20:09 
GeneralRe: auto login website Pin
Ravi Bhavnani16-Feb-05 2:06
professionalRavi Bhavnani16-Feb-05 2:06 
GeneralRe: auto login website Pin
humps15-Feb-05 9:49
humps15-Feb-05 9:49 
Questionwin32: SetSysColors for a single window/process? Pin
cybertank15-Feb-05 3:44
cybertank15-Feb-05 3:44 
AnswerRe: win32: SetSysColors for a single window/process? Pin
rocky_pulley15-Feb-05 4:31
rocky_pulley15-Feb-05 4:31 
Generalstop sub process Pin
includeh1015-Feb-05 2:50
includeh1015-Feb-05 2:50 
General8.3 format Pin
includeh1015-Feb-05 2:32
includeh1015-Feb-05 2:32 
GeneralRe: 8.3 format Pin
Antony M Kancidrowski15-Feb-05 2:40
Antony M Kancidrowski15-Feb-05 2:40 
GeneralRe: 8.3 format Pin
includeh1015-Feb-05 2:55
includeh1015-Feb-05 2:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.