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 "network/C4Network2.h"
#include "netpuncher/C4PuncherPacket.h"
#include <stdio.h>
#include <unordered_map>
#include <functional>
#include <random>
#include <stdexcept>
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 75 of file main.cpp.

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

76 {
77  // Log
78  printf("Starting puncher...\n");
79 
80  // Get port
81  uint16_t iPort = C4NetStdPortPuncher;
82  if (argc == 2)
83  {
84  iPort = strtoul(argv[1], nullptr, 10);
85  if (!iPort) iPort = C4NetStdPortPuncher;
86  }
87 
88  // Initialize
89  if (!Puncher.Init(iPort))
90  {
91  fprintf(stderr, "Could not initialize puncher: %s", Puncher.GetError());
92  return 1;
93  }
94 
95  // Log
96  printf("Listening on port %d...\n", iPort);
97 
98  // Execute forever
99  for (;;)
100  {
101  Puncher.ExecuteUntil(-1);
102  fprintf(stderr, "ERROR: %s\n", Puncher.GetError());
103  }
104 
105  return 0;
106 }
C4PuncherServer Puncher
virtual const char * GetError() const
Definition: C4NetIO.h:285
bool ExecuteUntil(int iTimeout=-1)
virtual bool Init(uint16_t iPort=addr_t::IPPORT_NONE)
Definition: C4NetIO.cpp:2434
const int16_t C4NetStdPortPuncher
Definition: C4Network2.h:33

Here is the call graph for this function:

void RecordRandom ( uint32_t  range,
uint32_t  val 
)

Definition at line 109 of file main.cpp.

109 {}

Variable Documentation

C4PuncherServer Puncher

Referenced by main().