#include <stdio.h>
#include<stdlib.h>
#include<string.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<sys/socket.h>
#include<sys/epoll.h>
#include<unistd.h>
#include<fcntl.h>
#include<time.h>
#define BUF_SIZE 1024
#define SERVER_PORT 8080
#define SERVER_HOST "192.168.106.28"
#define EPOLL_RUN_TIMEOUT -1
#define EPOLL_SIZE 100000
#define STR_WELCOME "welcome you id is%d"
#define STR_MESSAGE "client %d"
#define STR_NOONE_CONNECTED "noone connect to server except you"
#define CMD_EXIT "EXIT"
#define CHK(eval) \
if(eval <0) \
{ \
perror("eval"); \
exit(1); \
}
#include<stdlib.h>
#include<string.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<sys/socket.h>
#include<sys/epoll.h>
#include<unistd.h>
#include<fcntl.h>
#include<time.h>
#define BUF_SIZE 1024
#define SERVER_PORT 8080
#define SERVER_HOST "192.168.106.28"
#define EPOLL_RUN_TIMEOUT -1
#define EPOLL_SIZE 100000
#define STR_WELCOME "welcome you id is%d"
#define STR_MESSAGE "client %d"
#define STR_NOONE_CONNECTED "noone connect to server except you"
#define CMD_EXIT "EXIT"
#define CHK(eval) \
if(eval <0) \
{ \
perror("eval"); \
exit(1); \
}

这是一个使用C语言编写的程序,用于实现对服务器的大量并发连接压力测试。代码创建了EPOLL_SIZE(100000)个套接字,并连接到指定的服务器地址(192.168.106.28:8080)。在连接成功后,接收服务器返回的数据并关闭每个连接。程序最后输出完成测试所需的时间和总连接数。
最低0.47元/天 解锁文章
218

被折叠的 条评论
为什么被折叠?



