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

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