OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
main.cpp File Reference
#include "C4Include.h"
#include "netpuncher/C4PuncherHash.h"
#include "netpuncher/C4PuncherPacket.h"
#include "network/C4Network2.h"
#include <random>
#include <unordered_map>
Include dependency graph for main.cpp:

Go to the source code of this file.

Classes

class  C4PuncherServer
 

Functions

int main (int argc, char *argv[])
 
void RecordRandom (uint32_t range, uint32_t val)
 

Variables

C4PuncherServer Puncher
 

Function Documentation

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

Definition at line 85 of file main.cpp.

References C4NetStdPortPuncher, StdSchedulerProc::ExecuteUntil(), C4NetIO::GetError(), C4NetIOUDP::Init(), and Puncher.

86 {
87  // Log
88  printf("Starting puncher...\n");
89 
90  // Get port
91  uint16_t iPort = C4NetStdPortPuncher;
92  if (argc == 2)
93  {
94  iPort = strtoul(argv[1], nullptr, 10);
95  if (!iPort) iPort = C4NetStdPortPuncher;
96  }
97 
98  // Initialize
99  if (!Puncher.Init(iPort))
100  {
101  fprintf(stderr, "Could not initialize puncher: %s", Puncher.GetError());
102  return 1;
103  }
104 
105  // Log
106  printf("Listening on port %d...\n", iPort);
107 
108  // Execute forever
109  for (;;)
110  {
111  Puncher.ExecuteUntil(-1);
112  fprintf(stderr, "ERROR: %s\n", Puncher.GetError());
113  }
114 
115  return 0;
116 }
C4PuncherServer Puncher
virtual const char * GetError() const
Definition: C4NetIO.h:284
bool ExecuteUntil(int iTimeout=-1)
const int16_t C4NetStdPortPuncher
Definition: C4Network2.h:33
bool Init(uint16_t iPort=addr_t::IPPORT_NONE) override
Definition: C4NetIO.cpp:2410

Here is the call graph for this function:

void RecordRandom ( uint32_t  range,
uint32_t  val 
)

Definition at line 119 of file main.cpp.

119 {}

Variable Documentation

C4PuncherServer Puncher

Referenced by main().