socket 的时时刺激网络模块 只有接收没有上传 感兴趣可以试试看哦

/////////////////////////////////////////////////////////// 编译 release ’发布版本‘

 

#include<Windows.h>
#include<stdlib.h>
#pragma comment(lib,"WS2_32.lib")
#include <corecrt_wstdlib.h>
#include <iostream>
#include<stdio.h>
#include <Windows.h>
#include<list>
#include<iostream>
#include<istream>
#include<ostream>
#include <fstream>
#include<string>
using namespace std;


WSADATA wsd;


int retVal;//调用Socket函数的返回值
char buf[255] = "65431to2";


void main()
{

if (WSAStartup(MAKEWORD(2, 2), &wsd) != 0) {
printf("WSAStartup failed!\n");
}


SOCKADDR_IN ins;
ins.sin_addr.S_un.S_addr = (ULONG)"127.0.0.1";
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;
}

AS:


recv(soc, buf, 255, 0);
recv(soc, buf, 255, 0);
recv(soc, buf, 255, 0);
recv(soc, buf, 255, 0);

//谁攻击自己电脑查它 唉P             c++ 的API 是这个   getpeername


//struct sockaddr_in sa;
//int len = sizeof(sa);
//if(getpeername(soc,(struct sockaddr*)&sa, &len))
//{
// cout << "===,";
// printf("对方IP:%s ", inet_ntoa(sa.sin_addr));
// printf("对方PORT:%d ", ntohs(sa.sin_port));
// cout << "===,";
//}

printf_s(buf, "== += /=7 ';'");
send(soc, buf, 255, 0);

Sleep(12);


goto AS;


return;
};

posted on 2025-08-25 03:32  草丛有头猪  阅读(5)  评论(0)    收藏  举报

导航