MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / nw_InitNetworking

Function nw_InitNetworking

networking/networking.cpp:574–669  ·  view source on GitHub ↗

Inits the sockets layer to activity

Source from the content-addressed store, hash-verified

572
573// Inits the sockets layer to activity
574void nw_InitNetworking(int iReadBufSizeOverride) {
575 if (iReadBufSizeOverride == -1) {
576 iMaxReceiveBufsize = MAX_RECEIVE_BUFSIZE;
577 } else {
578 iMaxReceiveBufsize = iReadBufSizeOverride;
579 }
580
581 // reset our stats so we are ready to use them
582 nw_GetNetworkStats(NULL);
583
584#ifdef WIN32
585 WSADATA ws_data;
586 WORD ver = MAKEWORD(1, 1);
587#endif
588
589 static char exewithpath[_MAX_PATH * 2];
590 static char exefile[_MAX_PATH * 2];
591 static char ourargs[_MAX_PATH * 2];
592 static char exedir[_MAX_PATH * 2];
593 static char exeext[_MAX_PATH];
594 static char *fixdir;
595 static char szconntype[100];
596 int parmlen;
597 int len = 99;
598 Database->read("NetworkConnection", szconntype, &len);
599 if (stricmp(szconntype, "DIALUP") == 0) {
600 Dialup_connection = 1;
601 } else {
602 Dialup_connection = 0;
603 }
604 int iparg;
605
606 if (FindArg("-netdebug")) {
607 NetDebugFile = (CFILE *)cfopen("netdebug.log", "wa");
608 ASSERT(NetDebugFile);
609 cfprintf(NetDebugFile, "NetDebug.log opened at %f seconds\n", timer_GetTime());
610 }
611
612 iparg = FindArg("-useip");
613 if (!iparg) {
614 iparg = FindArg("+ip");
615 }
616 if (iparg) {
617 Net_fixed_ip = inet_addr(GameArgs[iparg + 1]);
618 if (Net_fixed_ip == INADDR_NONE) {
619 Net_fixed_ip = INADDR_NONE;
620 }
621 }
622#ifdef WIN32
623 if (!dp_DidLobbyLaunchGame()) {
624 // Tell direct play about this game
625 char *p = GetCommandLine();
626 mprintf(0, "Command line: %s\n", p);
627 parmlen = strlen(p);
628
629 int a;
630 for (a = 0; a < parmlen; ++a) {
631 if (p[a] == ' ') {

Callers 1

InitD3Systems1Function · 0.85

Calls 7

nw_GetNetworkStatsFunction · 0.85
cfopenFunction · 0.85
cfprintfFunction · 0.85
dp_DidLobbyLaunchGameFunction · 0.85
FindArgFunction · 0.50
ddio_SplitPathFunction · 0.50
readMethod · 0.45

Tested by

no test coverage detected