C++???????????
???????????? ???????[ 2014/8/27 10:37:54 ] ????????C++ ???????? NET
????C++???????????
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <string>
#include <utility>
#include <regex>
#include <fstream>
#include <WinSock2.h>
#include <Windows.h>
#pragma comment(lib?? "ws2_32.lib")
using namespace std;
void startupWSA()
{
WSADATA wsadata;
WSAStartup( MAKEWORD(2??0)?? &wsadata);
}
inline void cleanupWSA()
{
WSACleanup();
}
inline pair<string?? string> binaryString(const string &str?? const string &dilme)
{
pair<string?? string> result(str?? "");
auto pos = str.find(dilme);
if ( pos != string::npos )
{
result.first = str.substr(0?? pos);
result.second = str.substr(pos + dilme.size());
}
return result;
}
inline string getIpByHostName(const string &hostName)
{
hostent* phost = gethostbyname( hostName.c_str() );
return phost? inet_ntoa(*(in_addr *)phost->h_addr_list[0]): "";
}
inline SOCKET connect(const string &hostName)
{
auto ip = getIpByHostName(hostName);
if ( ip.empty() )
return 0;
auto sock = socket(AF_INET?? SOCK_STREAM?? 0);
if ( sock == INVALID_SOCKET )
return 0;
SOCKADDR_IN addr;
addr.sin_family = AF_INET;
addr.sin_port = htons(80);
addr.sin_addr.s_addr = inet_addr(ip.c_str());
if ( connect(sock?? (const sockaddr *)&addr?? sizeof(SOCKADDR_IN)) == SOCKET_ERROR )
return 0;
return sock;
}
inline bool sendRequest(SOCKET sock?? const string &host?? const string &get)
{
string http
= "GET " + get + " HTTP/1.1
"
+ "HOST: " + host + "
"
+ "Connection: close
";
return http.size() == send(sock?? &http[0]?? http.size()?? 0);
}
inline string recvRequest(SOCKET sock)
{
static timeval wait = {2?? 0};
static auto buffer = string(2048 * 100?? '
主站蜘蛛池模板:
久久免费视屏
|
欧美视频不卡一区二区三区
|
免费国产zzzwww色
|
高清一区二区亚洲欧美日韩
|
日韩网站免费
|
欧美久久一区二区
|
国产成人精品福利站
|
综合 欧美 国产 视频二区
|
久久国产一级毛片一区二区
|
国产年成美女网站视频免费看
|
男女扒开双腿猛进入免费看污
|
看黄在线观看
|
天天狠狠
|
一区二区三区国产精品
|
一个人看www在线是免费
|
国产日韩欧美综合
|
www.黄在线
|
九九精品视频一区二区三区
|
国产v国产v片大片线观看网站
|
777艳片
|
黄色三级在线观看
|
色偷偷av男人的天堂
|
亚洲精品午夜国产va久久成人
|
亚洲国产成人久久
|
国产美女高清一级a毛片
|
亚洲国产成人九九综合
|
欧洲性xxx
|
久草新在线观看
|
在线国产播放
|
久草中文在线观看
|
亚州 色 图 综合
|
黄色毛片三级
|
在线国产视频一区
|
hs网站在线观看
|
最近更新免费中文字幕大全
|
久久精品观看影院2828
|
国产精品japanese人妖
|
黄色片视频免费
|
最近中文字幕免费6
|
清清草视频在线观看
|
国产三级精品三级在专区
|