From e265035809d6d839b259edec8ac8b197ccce3249 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 12 Aug 2018 12:41:17 +0200 Subject: Remove old client and server --- Makefile | 2 +- client.c | 36 ------------------------------------ server.c | 39 --------------------------------------- 3 files changed, 1 insertion(+), 76 deletions(-) delete mode 100644 client.c delete mode 100644 server.c diff --git a/Makefile b/Makefile index eadce97..cbdd2f3 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC = gcc CFLAGS = -Wall -Wextra -O2 -g -std=c11 -fwrapv -pthread LDFLAGS = -pthread -TARGETS = server client serverd clientd +TARGETS = serverd clientd SOURCES = $(filter-out $(patsubst %,%.c,$(TARGETS)),$(wildcard *.c)) OBJECTS = $(patsubst %.c,%.o,$(SOURCES)) diff --git a/client.c b/client.c deleted file mode 100644 index aa9b13c..0000000 --- a/client.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "icmp_client.h" -#include "util.h" - -int main(void) { - int sock = icmp_client_open_socket(); - if (sock < 0) { - perror("icmp_client_open_socket"); - return 1; - } - - const char *ip_address = "127.0.0.1"; - // const char *ip_address = "192.168.43.220"; - // const char *ip_address = "198.211.118.67"; // tomsmeding.com - - if (icmp_client_send(sock, inet_addr(ip_address), 1234, "kaashandel", 10) < 0) { - perror("icmp_client_send"); - return 1; - } - - struct icmp_incoming reply = icmp_client_receive(sock); - if (reply.data == NULL) { - perror("icmp_client_receive"); - return 1; - } - - printf("Received length: %zd payload:\n", reply.length); - xxd(reply.data, reply.length); -} diff --git a/server.c b/server.c deleted file mode 100644 index df51032..0000000 --- a/server.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include -#include -#include -#include "icmp_server.h" -#include "util.h" - - -int main(void) { - int sock = icmp_server_open_socket(); - if (sock < 0) { - perror("icmp_server_open_socket"); - return 1; - } - - while (true) { - struct icmp_incoming msg = icmp_server_receive(sock); - if (msg.data == NULL) { - perror("icmp_server_communicate"); - return 1; - } - - printf("Received: id %d seqnum %d data:\n", msg.id, msg.seqnum); - xxd(msg.data, msg.length); - - char data[msg.length + 1]; - for (size_t i = 0; i < msg.length; i++) { - data[i] = toupper(msg.data[i]); - } - data[msg.length] = '!'; - - if (icmp_server_send_reply(sock, msg.source_addr, msg.id, msg.seqnum, data, msg.length + 1) < 0) { - perror("icmp_server_send_reply"); - } - } - - close(sock); -} -- cgit v1.2.3