UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
main.cpp File Reference
#include <iostream>
#include <charconv>
#include "nat-helper.hpp"
Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Author
Martin Piatka piatk.nosp@m.a@ce.nosp@m.snet..nosp@m.cz

Definition in file main.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 48 of file main.cpp.

48 {
49 int port = 12558;
50
51 for(int i = 1; i < argc; i++){
52 std::string_view arg(argv[i]);
53 if(arg == "-h" || arg == "--help"){
54 printUsage(argv[0]);
55 return 0;
56 } else if(arg == "-p" || arg == "--port"){
57 if(i + 1 >= argc){
58 std::cerr << "Expected port number\n";
59 printUsage(argv[0]);
60 return 1;
61 }
62 std::string_view portStr(argv[++i]);
63 auto res = std::from_chars(portStr.data(), portStr.data() + portStr.size(), port);
64 if(res.ec != std::errc() || res.ptr == portStr.data()){
65 std::cerr << "Failed to parse port number\n";
66 printUsage(argv[0]);
67 return 1;
68 }
69 } else {
70 std::cerr << "Unknown argument " << arg << std::endl;
71 printUsage(argv[0]);
72 return 1;
73 }
74 }
75
76
77 NatHelper server(port);
78
79 server.run(false);
80
81 return 0;
82}

References NatHelper::run().

Here is the call graph for this function: