|
|
@ -1,6 +1,6 @@
|
|
|
|
#include "easysock.hpp"
|
|
|
|
#include "easysock.hpp"
|
|
|
|
#include <iostream>
|
|
|
|
#include <iostream>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <cerrno>
|
|
|
|
#include "exception_consts.hpp"
|
|
|
|
#include "exception_consts.hpp"
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
Client class - Defines a TCP/UDP client.
|
|
|
|
Client class - Defines a TCP/UDP client.
|
|
|
@ -44,6 +44,12 @@ public:
|
|
|
|
this->protocol = protocol;
|
|
|
|
this->protocol = protocol;
|
|
|
|
this->port = port;
|
|
|
|
this->port = port;
|
|
|
|
this->address = std::string(address);
|
|
|
|
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 {
|
|
|
|
try {
|
|
|
|
create_socket();
|
|
|
|
create_socket();
|
|
|
|
} catch (int e) {
|
|
|
|
} catch (int e) {
|
|
|
|