#include #include #include "JSystem/JNetwork.hh" #include "JNet/JHostname.hh" #include "JNet/JUDPSocket.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" int main(int argc, char **argv) { using namespace std; using namespace JPP; JHostname hostname; string message; int debug; try { JParser<> zap; zap['H'] = make_field(hostname); zap['m'] = make_field(message); zap['d'] = make_field(debug) = 0; zap.read(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } JUDPSocket udp(hostname); if (udp.write(message.c_str(), message.size()) < 0) { FATAL("Error writing data." << endl); } const int N = 1000; char buffer[N]; const int length = udp.read(buffer, N); if (length < 0) { FATAL("Error reading data." << endl); } cout << string(buffer, length) << endl; udp.shutdown(); return 0; }