36 lines
764 B
C++
36 lines
764 B
C++
#include "SimpleSock.h"
|
|
#include <iostream>
|
|
using namespace std;
|
|
using namespace SimpleSock;
|
|
|
|
int main()
|
|
{
|
|
InitSimpleSock();
|
|
|
|
sock s;
|
|
if (ConnectWithHttpProxy(s, "127.0.0.1", 12759, "106.53.10.163", 80) < 0)
|
|
{
|
|
cout << "Failed Connect Http Proxy" << endl;
|
|
return 1;
|
|
}
|
|
|
|
const char* data = "GET / HTTP/1.1\r\nConnection: close\r\nHost: paste.kiritow.com\r\n\r\n";
|
|
if (s.sendall(data, strlen(data)) != strlen(data))
|
|
{
|
|
cout << "send failed" << endl;
|
|
return 1;
|
|
}
|
|
|
|
char buff[1024] = { 0 };
|
|
int ret;
|
|
while ((ret = s.recv(buff, 1024)) > 0)
|
|
{
|
|
string temp = string(buff, ret);
|
|
cout << temp << endl;
|
|
memset(buff, 0, 1024);
|
|
}
|
|
cout << "\nFinalCode: " << ret << " Errcode:" << s.getError() << " ErrMsg:" << s.getErrorMessage() << endl;
|
|
|
|
return 0;
|
|
}
|