aboutsummaryrefslogtreecommitdiff
path: root/comp3331/server/src/client/main.cc
blob: a452c3e57faad74ecea5b915418c1c42ba2121fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "client/main.hh"

using namespace client;

int main(const int argc, const char* const argv[]) {

    if (argc != 2) {
        std::cerr << "usage: ./client PORT<int>\n";
        return EXIT_SUCCESS;
    }

    const char* const address = "localhost"; // not an argument fsr
    const char* const port = argv[1];

    try {
        shared::set_exit_handler();
        do_client(address, port);
    } catch (const std::exception& e) {
        std::cerr << "caught exception from client!\n\twhat(): " << e.what()
                  << '\n';
        return EXIT_FAILURE;
    } catch (...) {
        std::cerr << "unhandled exception from client!\n";
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}