|
|
@ -96,7 +96,7 @@ Mode check_server_client(int argc, char** argv, Server* server, Client* client)
|
|
|
|
|
|
|
|
|
|
|
|
/* Check if IP is valid */
|
|
|
|
/* Check if IP is valid */
|
|
|
|
if (check_ip_ver(addr.data()) < 0) {
|
|
|
|
if (check_ip_ver(addr.data()) < 0) {
|
|
|
|
throw EXCEPT_INVALIDARGS;
|
|
|
|
throw EXCEPT_INVALIDIP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string code = connect_code::encode(addr, std::to_string(port));
|
|
|
|
std::string code = connect_code::encode(addr, std::to_string(port));
|
|
|
@ -134,7 +134,7 @@ int main(int argc, char** argv) {
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (e == EXCEPT_INVALIDARGS) {
|
|
|
|
if (e == EXCEPT_INVALIDARGS) {
|
|
|
|
std::cout << "Invalid argument.." << std::endl;
|
|
|
|
std::cout << "Invalid argument." << std::endl;
|
|
|
|
return -2;
|
|
|
|
return -2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (e == EXCEPT_CONNREFUSED) {
|
|
|
|
if (e == EXCEPT_CONNREFUSED) {
|
|
|
@ -145,9 +145,13 @@ int main(int argc, char** argv) {
|
|
|
|
std:: cout << "Unable to use requested address for server." << std::endl;
|
|
|
|
std:: cout << "Unable to use requested address for server." << std::endl;
|
|
|
|
return -4;
|
|
|
|
return -4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e == EXCEPT_INVALIDIP) {
|
|
|
|
|
|
|
|
std::cout << "Invalid IP address provided." << std::endl;
|
|
|
|
|
|
|
|
return -5;
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch(std::invalid_argument& inv) {
|
|
|
|
} catch(std::invalid_argument& inv) {
|
|
|
|
std::cout << inv.what() << std::endl;
|
|
|
|
std::cout << inv.what() << std::endl;
|
|
|
|
return -5;
|
|
|
|
return -6;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Initialize window and other variables */
|
|
|
|
/* Initialize window and other variables */
|
|
|
|