#include #include #include #include #include "JSystem/JNetwork.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to print IP address. * \author mdejong */ int main(int argc, char* argv[]) { using namespace std; using namespace JPP; string host_name; try { JParser<> zap("Example program to print IP address."); zap['H'] = make_field(host_name) = "localhost"; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } int ip = getIPnumber(host_name); cout << "IP number " << ip << endl; cout << "IP address " << getIPaddress(ip) << endl; cout << "host name " << getHostname(ip) << endl; cout << "subaddress " << dec << getSubaddress(ip) << " (dec)" << ' ' << hex << getSubaddress(ip) << " (hex)" << endl; cout << endl; vector result = getListOfIPaddresses(); for (vector::const_iterator i = result.begin(); i != result.end(); ++i) { cout << "IP address " << *i << endl; } }