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

Function main

cpp/testapps/cppLinuxRunnerGame/main.cpp:230–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230int main()
231{
232 try
233 {
234 Microsoft::Azure::Gaming::GSDK::start();
235 Microsoft::Azure::Gaming::GSDK::registerShutdownCallback(&inShutdown);
236 Microsoft::Azure::Gaming::GSDK::registerHealthCallback(&isHealthy);
237 Microsoft::Azure::Gaming::GSDK::registerMaintenanceCallback(&maintenanceScheduled);
238
239 // Grab asset files
240 std::ifstream assetFileTextStream(assetFileTextPath);
241 if (assetFileTextStream.good()) {
242 getline(assetFileTextStream, assetFileText);
243 assetFileTextStream.close();
244 }
245
246 std::ifstream assetFileTarStream(assetFileTarPath);
247 if (assetFileTarStream.good()) {
248 getline(assetFileTarStream, assetFileTar);
249 assetFileTarStream.close();
250 }
251
252 std::ifstream assetFileTarGzStream(assetFileTarGzPath);
253 if (assetFileTarGzStream.good()) {
254 getline(assetFileTarGzStream, assetFileTarGz);
255 assetFileTarGzStream.close();
256 }
257
258 // Grab cert
259 getTestCert();
260
261 int opt = 1;
262
263 // Creating socket file descriptor
264 if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) == 0)
265 {
266 perror("socket failed");
267 exit(EXIT_FAILURE);
268 }
269
270 // Forcefully attaching socket to the port
271 if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT,
272 &opt, sizeof(opt)))
273 {
274 perror("setsockopt");
275 exit(EXIT_FAILURE);
276 }
277 address.sin_family = AF_INET;
278 address.sin_addr.s_addr = INADDR_ANY;
279 address.sin_port = htons(PORT);
280
281 if (bind(server_fd, (struct sockaddr *)&address,
282 sizeof(address))<0)
283 {
284 perror("bind failed");
285 exit(EXIT_FAILURE);
286 }
287 if (listen(server_fd, SOMAXCONN) < 0)

Callers

nothing calls this directly

Calls 3

goodMethod · 0.80
whatMethod · 0.80
getTestCertFunction · 0.70

Tested by

no test coverage detected