MCPcopy Create free account
hub / github.com/Codesire-Deng/co_context / main

Function main

example/netcat_timeout.cpp:57–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57int main(int argc, const char *argv[]) {
58 if (argc < 3) {
59 printf("Usage:\n %s hostname port\n %s -l port\n", argv[0], argv[0]);
60 return 0;
61 }
62
63 io_context context;
64
65 int port = atoi(argv[2]);
66 if (strcmp(argv[1], "-l") == 0) {
67 context.co_spawn(server(port));
68 } else {
69 context.co_spawn(client(argv[1], port));
70 }
71
72 context.start();
73 context.join();
74
75 return 0;
76}

Callers

nothing calls this directly

Calls 5

startMethod · 0.80
joinMethod · 0.80
serverFunction · 0.70
clientFunction · 0.70
co_spawnMethod · 0.45

Tested by

no test coverage detected