MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / iter

Function iter

test/sockets/test_sockets_partial_server.c:73–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void iter() {
74 int res;
75 fd_set fdr;
76 fd_set fdw;
77
78 // see if there are any connections to accept / write to
79 FD_ZERO(&fdr);
80 FD_ZERO(&fdw);
81 FD_SET(serverfd, &fdr);
82 if (clientfd) FD_SET(clientfd, &fdw);
83 res = select(64, &fdr, &fdw, NULL, NULL);
84 if (res == -1) {
85 perror("select failed");
86 exit(EXIT_SUCCESS);
87 }
88
89 if (FD_ISSET(serverfd, &fdr)) {
90 printf("accepted someone\n");
91 clientfd = accept(serverfd, NULL, NULL);
92 assert(clientfd != -1);
93 }
94
95 if (FD_ISSET(clientfd, &fdw)) {
96 do_send(clientfd);
97 cleanup_client();
98 }
99}
100
101int main() {
102 struct sockaddr_in addr;

Callers 1

mainFunction · 0.70

Calls 8

selectFunction · 0.85
perrorFunction · 0.85
printfFunction · 0.85
do_sendFunction · 0.85
cleanup_clientFunction · 0.85
exitFunction · 0.50
acceptFunction · 0.50
assertFunction · 0.50

Tested by

no test coverage detected