MCPcopy Create free account
hub / github.com/PlayFab/gsdk / main

Function main

cpp/testapps/cppWindowsRunnerGame/main.cpp:318–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

316}
317
318int main(int argc, char* argv[])
319{
320 try
321 {
322 // Index starts from 1 to exclude executable path
323 for (int i = 1; i < argc - 1; i++)
324 {
325 cmdArgs = cmdArgs + argv[i] + " ";
326 }
327
328 if (argc > 1)
329 {
330 cmdArgs = cmdArgs + argv[argc - 1];
331 }
332
333 Microsoft::Azure::Gaming::GSDK::start();
334 Microsoft::Azure::Gaming::GSDK::registerShutdownCallback(&inShutdown);
335 Microsoft::Azure::Gaming::GSDK::registerHealthCallback(&isHealthy);
336 //Microsoft::Azure::Gaming::GSDK::registerMaintenanceCallback(&maintenanceScheduled);
337 Microsoft::Azure::Gaming::GSDK::registerMaintenanceV2Callback(&maintenanceV2Scheduled);
338
339 // Grab asset files
340 std::ifstream assetFileTextStream(getExecutableDirectory() + "\\" + assetFileTextPath);
341 if (assetFileTextStream.good()) {
342 getline(assetFileTextStream, assetFileText);
343 assetFileTextStream.close();
344 }
345
346 // Grab cert
347 getTestCert();
348
349 char opt = 1;
350
351 // Creating socket file descriptor
352 if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) == 0)
353 {
354 perror("socket failed");
355 fflush(stdout);
356 exit(EXIT_FAILURE);
357 }
358
359 // Forcefully attaching socket to the port
360 if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)))
361 {
362 perror("setsockopt");
363 fflush(stdout);
364 exit(EXIT_FAILURE);
365 }
366 address.sin_family = AF_INET;
367 address.sin_addr.s_addr = INADDR_ANY;
368 address.sin_port = htons(PORT);
369
370 if (bind(server_fd, (struct sockaddr *)&address, sizeof(address)) < 0)
371 {
372 perror("bind failed");
373 fflush(stdout);
374 exit(EXIT_FAILURE);
375 }

Callers

nothing calls this directly

Calls 4

getExecutableDirectoryFunction · 0.85
goodMethod · 0.80
whatMethod · 0.80
getTestCertFunction · 0.70

Tested by

no test coverage detected