#include #include #include #include #include #include "JSystem/JNetwork.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; int port; int debug; try { JParser<> zap; zap['P'] = make_field(port) = 2000; zap['d'] = make_field(debug) = 0; zap.read(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } try { JUDPSocket server(port); const int N = 1000; char buffer[N]; JUDPSocket udp; const int length = server.read(buffer, N, udp); if (length < 0) { FATAL("Error reading data." << endl); } if (udp.write(buffer, length) < 0) { FATAL("Error writing data." << endl); } server.close(); } catch(const exception& error) { FATAL(error.what() << endl); } return 0; }