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?? '
主站蜘蛛池模板:
动漫精品一级毛片动漫
|
国产成人在线小视频
|
999久久久免费精品国产牛牛
|
aaa一级
|
欧美精品www|
午夜精品在线
|
黄色三级毛片
|
一本大道香焦在线视频
|
狍和美女一级aa毛片
|
成人三级视频
|
亚洲精品国产手机
|
日本无翼乌全彩无遮挡动漫
|
中文字幕成人免费视频
|
日本黄色小视频在线观看
|
国产a一级毛片午夜剧院
|
久久精品视屏
|
小明看片成人永久在线观看
|
欧美大黄
|
国产欧美亚洲精品第一页久久肉
|
午夜影院一区二区
|
欧美日韩精彩视频
|
欧美日韩在线国产
|
亚洲男人影院
|
最近中文字幕2019高清免费
|
欧美一区日韩精品
|
在线亚洲欧洲国产综合444
|
亚洲成a人在线观看
|
亚洲毛片网
|
日本在线亚州精品视频在线
|
怡红院在线视频精品观看
|
成人国产综合
|
国产草逼视频
|
一个人看的高清www视频免费
|
免费看大黄高清网站视频在线
|
看全色黄大色黄大片 视
|
高h辣h双处全是肉一对一
|
天天做天天爱天天爽
|
欧美一级鲁丝片免费看
|
天天夜夜人人
|
亚洲阿v天堂在线
|
国99久9在线 | 免费
|