2023-08-27 14:18:17 +00:00
|
|
|
#include <algorithm>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cstring>
|
|
|
|
#include <ctime>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <csignal>
|
|
|
|
#include <iostream>
|
|
|
|
#include <iomanip>
|
|
|
|
#include <tuple>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
2023-08-27 19:40:36 +00:00
|
|
|
#define BIGDIM 10000
|
|
|
|
|
2023-08-27 14:18:17 +00:00
|
|
|
int makeSocket() {
|
|
|
|
int sockfd;
|
|
|
|
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
|
|
|
perror("socket failed");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
return sockfd;
|
|
|
|
}
|
|
|
|
|
|
|
|
void connectTo(int sock, const char* host, int port) {
|
|
|
|
struct sockaddr_in serv_addr;
|
|
|
|
serv_addr.sin_family = AF_INET;
|
|
|
|
serv_addr.sin_addr.s_addr = inet_addr(host);
|
|
|
|
serv_addr.sin_port = htons(port);
|
|
|
|
|
|
|
|
if (connect(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
|
|
|
|
perror("Connection failed");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("Connected to %s: %d\n", host, port);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
int socket = makeSocket();
|
|
|
|
connectTo(socket, "127.0.0.1", 7777);
|
|
|
|
|
2023-08-27 19:40:36 +00:00
|
|
|
uint64_t alotofvalues[BIGDIM];
|
2023-08-27 14:18:17 +00:00
|
|
|
|
2023-08-27 19:40:36 +00:00
|
|
|
for (int i = 1; i < BIGDIM; i++) {
|
|
|
|
alotofvalues[i] = i;
|
|
|
|
}
|
2023-08-27 14:18:17 +00:00
|
|
|
|
2023-08-27 19:40:36 +00:00
|
|
|
int send_counter = 0;
|
|
|
|
for (;;) {
|
|
|
|
alotofvalues[0] = send_counter;
|
|
|
|
ssize_t bytes = send(socket, reinterpret_cast<char*>(alotofvalues), sizeof(alotofvalues), 0);
|
|
|
|
sleep(10000);
|
|
|
|
send_counter++;
|
2023-08-27 14:18:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|