diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | sakkom.c | 6 |
3 files changed, 14 insertions, 2 deletions
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 + @@ -12,6 +12,8 @@ #include <stdlib.h> #include <string.h> #include <sys/types.h> +#include <netinet/in.h> +#include <sys/socket.h> #include <time.h> #include <unistd.h> @@ -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); } |