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 71 of file main.cpp.

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

72 {
73  // Log
74  printf("Starting puncher...\n");
75 
76  // Get port
77  uint16_t iPort = C4NetStdPortPuncher;
78  if (argc == 2)
79  {
80  iPort = strtoul(argv[1], nullptr, 10);
81  if (!iPort) iPort = C4NetStdPortPuncher;
82  }
83 
84  // Initialize
85  if (!Puncher.Init(iPort))
86  {
87  fprintf(stderr, "Could not initialize puncher: %s", Puncher.GetError());
88  return 1;
89  }
90 
91  // Log
92  printf("Listening on port %d...\n", iPort);
93 
94  // Execute forever
95  for (;;)
96  {
98  fprintf(stderr, "ERROR: %s\n", Puncher.GetError());
99  }
100 
101  return 0;
102 }
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:2405

Here is the call graph for this function:

void RecordRandom ( uint32_t  range,
uint32_t  val 
)

Definition at line 105 of file main.cpp.

105 {}

Variable Documentation

C4PuncherServer Puncher

Referenced by main().