#include <stdio.h>
#include "CClient.hpp"
int main(int argc, char** argv)
{
if (argc < 3)
{
printf("Usage:");
printf("t%s <hostname> <port>");
return 0;
}
CClient* pClient = new CClient();
char* pszRecvMessage = new char[1024];
pClient->Create();
pClient->Connect(argv[1], atoi(argv[2]));
pClient->Send("GET / HTTP/1.1rn");
pClient->Send("Accept: */*rn");
pClient->Send("Accept-Language: plrn");
pClient->Send("Accept-Encoding: gzip, deflatern");
pClient->Send("Host: www.google.comrn");
pClient->Send("Connection: Keep-Alivern");
pClient->Send("rn");
while (pClient->Recv(pszRecvMessage, 1023))
{
printf("%s", pszRecvMessage);
}
delete [] pszRecvMessage;
delete pClient;
return 0;
}
This code was thrown together in a few minutes, and may contain errors (and missing class files which I don't share :))
Feel free to pay me for the actual CClient.cpp and CClient.hpp code :)
If you learn basic sockets on Windows, Linux, BSD, or whatever, what you want to do is pretty simple.