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

Function main

lib_acl_cpp/samples/socket/s1/main.cpp:6–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <unistd.h>
5
6int main(int argc, char* argv[])
7{
8 acl::server_socket server;
9 acl::string addr = "127.0.0.1:9001";
10
11 if (argc >= 2)
12 addr = argv[1];
13
14 acl::acl_cpp_init();
15
16 if (server.open(addr) == false)
17 {
18 printf("open %s error %s\r\n", addr.c_str(), acl::last_serror());
19 return 1;
20 }
21 else
22 printf("open %s ok\r\n", addr.c_str());
23
24 while (true)
25 {
26 acl::socket_stream* client = server.accept();
27 if (client == NULL)
28 {
29 printf("accept failed: %s\r\n", acl::last_serror());
30 break;
31 }
32
33 printf("before set sendbuf's size: %d, readbuf's size: %d\r\n",
34 client->get_tcp_sendbuf(), client->get_tcp_recvbuf());
35
36 client->set_tcp_sendbuf(1024000);
37 client->set_tcp_recvbuf(2048000);
38
39 printf("after set sendbuf's size: %d, readbuf's size: %d\r\n",
40 client->get_tcp_sendbuf(), client->get_tcp_recvbuf());
41
42 /*
43 acl::string buf;
44 if (client->gets(buf))
45 printf("gets: %s\r\n", buf.c_str());
46 else
47 printf("gets error: %s\r\n", acl::last_serror());
48
49 delete client;
50 printf("close client ok\r\n");
51 */
52 }
53
54 return (0);
55}

Callers

nothing calls this directly

Calls 7

acl_cpp_initFunction · 0.85
get_tcp_sendbufMethod · 0.80
get_tcp_recvbufMethod · 0.80
last_serrorFunction · 0.50
openMethod · 0.45
c_strMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…