diff --git a/includes/client.hpp b/includes/client.hpp index 80062e0..37f24e7 100644 --- a/includes/client.hpp +++ b/includes/client.hpp @@ -1,6 +1,6 @@ #include "easysock.hpp" #include -#include +#include #include "exception_consts.hpp" /* Client class - Defines a TCP/UDP client. @@ -44,6 +44,12 @@ public: this->protocol = protocol; this->port = port; this->address = std::string(address); + + /* Check to see if the given IP address matches the given ip_ver */ + if ((check_ip_ver(address.data() == 4 && ip_ver == 6) || (chcek_ip_ver(address.data() == 6 && address == 4)) { + throw std::invalid_argument("Invalid IP address for given type."); + } + try { create_socket(); } catch (int e) {