From ce4706a4c92a762fe6e5c4fed29fdd8ab1ba6651 Mon Sep 17 00:00:00 2001 From: bru Date: Sun, 6 Feb 2022 19:48:53 +0000 Subject: =?UTF-8?q?Primeros=20pasos=20en=20la=20texto-plan/FreeBSDizaci?= =?UTF-8?q?=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ Makefile | 8 ++++++++ sakkom.c | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd47f90 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +sakkom +tags diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9cb5493 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +CC=cc +LIBS=-lpthread +all: + $(CC) -o sakkom sakkom.c $(LIBS) + +clean: + rm sakkom + diff --git a/sakkom.c b/sakkom.c index 5dbcea0..3a7980c 100644 --- a/sakkom.c +++ b/sakkom.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include #include @@ -634,11 +636,11 @@ int main() { struct sockaddr_in listen_addr = {0}, client_addr = {0}; struct sockaddr_in6 listen6_addr = {0}; - if ((listen_fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { + if ((listen_fd = socket(PF_INET, SOCK_STREAM, 0)) == -1) { perror("IPv4 socket"); exit(EXIT_FAILURE); } - if ((listen6_fd = socket(AF_INET6, SOCK_STREAM, 0)) == -1) { + if ((listen6_fd = socket(PF_INET6, SOCK_STREAM, 0)) == -1) { perror("IPv6 socket"); exit(EXIT_FAILURE); } -- cgit v1.2.3