connection.c
changeset 111 2247473fd12d
parent 84 f59d8a8e786f
child 131 b5ad49852adc
--- a/connection.c
+++ b/connection.c
@@ -12,6 +12,10 @@
 #include <netdb.h>
 #include <arpa/inet.h>
 
+#include <netinet/in.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
 int connection (char *ip, unsigned short port)
 {
     struct hostent *hs;
@@ -20,7 +24,7 @@
     int sockfd;
 
     memset (&sock, 0, sizeof (sock));
-    sock.sin_family = AF_INET;
+    sock.sin_family = PF_INET;
     sock.sin_port = htons (port);
 
     if ((sock.sin_addr.s_addr = inet_addr (ip)) == -1) {
@@ -32,7 +36,7 @@
         memcpy (&sock.sin_addr.s_addr, hs->h_addr_list[0], hs->h_length);
     }
 
-    if ((sockfd = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
+    if ((sockfd = socket (PF_INET, SOCK_STREAM, 0)) < 0) {
         perror ("[-] Error");
         return -1;
     }