MCPcopy Create free account
hub / github.com/acl-dev/acl / vstream_server

Function vstream_server

lib_acl/samples/vstream/main.cpp:63–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63static int vstream_server(void)
64{
65 const char *myname = "vstream_server";
66 ACL_VSTREAM *sstream, *client;
67 char ebuf[256];
68
69 sstream = acl_vstream_listen(addr, 128);
70 if (sstream == NULL) {
71 printf("%s(%d): listen on %s error(%s)\r\n",
72 myname, __LINE__, addr,
73 acl_last_strerror(ebuf, sizeof(ebuf)));
74 return (-1);
75 }
76
77 acl_tcp_defer_accept(ACL_VSTREAM_SOCK(sstream), 0);
78 printf("%s: listen %s ok\r\n", myname, addr);
79 while (1) {
80 client = acl_vstream_accept(sstream, NULL, 0);
81 if (client == NULL) {
82 printf("%s(%d): accept error(%s)\r\n",
83 myname, __LINE__,
84 acl_last_strerror(ebuf, sizeof(ebuf)));
85 return (-1);
86 }
87 printf("accept one\r\n");
88 if (1)
89 reply_client2(client);
90 else
91 reply_client(client);
92 acl_vstream_close(client);
93 }
94
95 return (0);
96}
97
98static int vstream_client(void)
99{

Callers 1

mainFunction · 0.70

Calls 7

acl_vstream_listenFunction · 0.85
acl_last_strerrorFunction · 0.85
acl_tcp_defer_acceptFunction · 0.85
acl_vstream_acceptFunction · 0.85
reply_client2Function · 0.85
acl_vstream_closeFunction · 0.85
reply_clientFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…