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

Function run

lib_acl_cpp/samples/telnet/main.cpp:71–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71static void run(ACL_EVENT* event)
72{
73 acl::socket_stream udp;
74
75 // �󶨱��ص�ַ
76 if (udp.bind_udp(__local_addr) == false) {
77 printf("bind addr %s error %s\r\n",
78 __server_addr, acl::last_serror());
79 return;
80 }
81
82 // ����Զ�̷����ַ
83 udp.set_peer(__server_addr);
84 printf("local addr: %s, set peer addr: %s\r\n",
85 udp.get_local(true), __server_addr);
86 printf("fd: %d, local: %s, %p\r\n",
87 udp.sock_handle(), udp.get_local(true), &udp);
88
89 udp.set_rw_timeout(100);
90 ACL_VSTREAM* udp_stream = udp.get_vstream();
91
92 acl::socket_stream stdio_in;
93 stdio_in.open(0);
94
95 ACL_VSTREAM* in = stdio_in.get_vstream();
96 acl::socket_stream stdio_out;
97 stdio_out.open(2);
98
99 udp.set_tcp_non_blocking(true);
100 stdio_in.set_tcp_non_blocking(true);
101
102 acl_event_enable_read(event, in, 0, stdin_read_callback, &udp);
103 acl_event_enable_read(event, udp_stream, 0,
104 udp_read_callback, &stdio_out);
105
106 stdio_out.write("Escape character is '^]'.\r\n");
107
108 while (true) {
109 acl_event_loop(event);
110 }
111}
112
113static void usage(const char* procname)
114{

Callers 15

mainFunction · 0.70
get_jobsMethod · 0.50
showMethod · 0.50
helloMethod · 0.50
executeMethod · 0.50
get_numberMethod · 0.50
get_number64Method · 0.50
check_statusMethod · 0.50
get_statusMethod · 0.50
get_stringMethod · 0.50
get_stringsMethod · 0.50
scan_keysMethod · 0.50

Calls 11

acl_event_enable_readFunction · 0.85
acl_event_loopFunction · 0.85
bind_udpMethod · 0.80
set_rw_timeoutMethod · 0.80
last_serrorFunction · 0.50
set_peerMethod · 0.45
get_localMethod · 0.45
sock_handleMethod · 0.45
get_vstreamMethod · 0.45
openMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected