Refactor: Rewriting new functions and classes in C++ with better code readability in mind

This commit is contained in:
AfonsoCMSousa
2025-11-12 17:01:07 +00:00
parent b2f283fff2
commit 43827f8f12
3 changed files with 86 additions and 14 deletions
+14
View File
@@ -1,4 +1,5 @@
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <stdexcept>
#include <string>
@@ -6,12 +7,25 @@
#include "file.hpp" // for parce_args
#include "net.hpp" // for socket operations
#include "server_structs.h"
using namespace std;
int main(int argc, char *argv[]) {
app_info app = parce_args(argc, argv);
api_packet packet;
try {
Socket sock;
sock.connect(app.app_server_out_ip, app.app_port_out);
packet = sock.create_packet((uint8_t)app.app_id);
sock.set_packet(packet);
sock.send();
} catch (const runtime_error &e) {
cerr << "Error: " << e.what() << endl;
return 1;
}
return 0;
}