圆呆码

复制代码
#include<WINSOCK2.H>
#include<iostream>
#include<string>
using namespace std;
#include<stdlib.h>
#define BUF_SIZE 1377
#pragma comment(lib,"WS2_32.lib")


int main()
{
    WSADATA wsd;
    SOCKET sHost;
    SOCKADDR_IN servAddr;//服务器地址
    int retVal;//调用Socket函数的返回值
    char buf[BUF_SIZE];
    //初始化Socket环境
    if (WSAStartup(MAKEWORD(2, 2), &wsd) != 0) {
        printf("WSAStartup failed!\n");
        return 1;
    }
    //创建监听的Socket
    sHost = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if (INVALID_SOCKET == sHost) {
        printf("socket failed!\n");
        WSACleanup();
        return -1;
    }
    //设置服务器Socket地址
    servAddr.sin_family = AF_INET;
    servAddr.sin_addr.S_un.S_addr = (ULONG)"103.84.110.229";
    //在实际应用中,建议将服务器的IP地址和端口号保存在配置文件中
    servAddr.sin_port = htons(80);
    //计算地址的长度
    int sServerAddlen = sizeof(servAddr);
    //链接服务器
    retVal = connect(sHost, (LPSOCKADDR)&servAddr, sizeof(servAddr));

apple:
        
        //向服务器发送字符串,并显示反馈信息
        printf("input a string to sen;0/47/3/3/6;input a st-=177/0;ring to send:%;/0/47/3/3/6;input a string to send:%;/0/47/3/3/6;input a string to send:%;/0/47/3/3/6;input a string to send:%;/;0/47/3/3/6;input a string to send:%;/0/47/3/3/6;");
        std::string str;

        //向服务器发送数据
        retVal = send(sHost, buf, strlen(buf), 0);
        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
        retVal = send(sHost, buf, strlen(buf), 0);


        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
        retVal = send(sHost, buf, strlen(buf), 0);


        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
        retVal = send(sHost, buf, strlen(buf), 0);


        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
        retVal = send(sHost, buf, strlen(buf), 0);


        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
        retVal = send(sHost, buf, strlen(buf), 0);


        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
        retVal = send(sHost, buf, strlen(buf), 0);


        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
        retVal = send(sHost, buf, strlen(buf), 0);


        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
        retVal = send(sHost, buf, strlen(buf), 0);


        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
        retVal = send(sHost, buf, strlen(buf), 0);


        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
        retVal = send(sHost, buf, strlen(buf), 0);


        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
        retVal = send(sHost, buf, strlen(buf), 0);


        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
        retVal = send(sHost, buf, strlen(buf), 0);


        retVal = send(sHost, buf, strlen(buf), 0);

        retVal = send(sHost, buf, strlen(buf), 0);

        Sleep(7);
goto apple;


        //if (SOCKET_ERROR == retVal) {
        //    printf("send failed!\n");
        //    closesocket(sHost);
        //    WSACleanup();
        //    return -1;
        //}
        ////接收服务器回传的数据
        retVal = recv(sHost, buf, sizeof(buf) + 1, 0);

        if (strcmp(buf, "quit"));

}
复制代码

 

posted on   草丛有头猪  阅读(6)  评论(1编辑  收藏  举报

相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
· AI Agent开发,如何调用三方的API Function,是通过提示词来发起调用的吗
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示