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

Method run

lib_fiber/samples-gui/WinFiber/FiberConnect.cpp:18–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18void CFiberConnect::run(void)
19{
20#if 0
21 acl::string serverAddr(m_serverAddr);
22 char *addr = serverAddr.c_str();
23 char *port_s = strchr(addr, ':');
24
25 ASSERT(port_s && *(port_s + 1));
26 *port_s++ = 0;
27
28 struct sockaddr_in sa;
29 int len = sizeof(sa);
30 memset(&sa, 0, sizeof(sa));
31 sa.sin_family = AF_INET;
32 sa.sin_port = htons(atoi(port_s));
33 sa.sin_addr.s_addr = inet_addr(addr);
34
35 socket_t sock = acl_fiber_socket(AF_INET, SOCK_STREAM, 0);
36
37 if (acl_fiber_connect(sock, (const struct sockaddr*) &sa, len) < 0)
38 printf("connect %s error %s\r\n", m_serverAddr.c_str(),
39 acl::last_serror());
40 else
41 doEcho(sock);
42
43 acl_fiber_close(m_sock);
44#else
45 acl::socket_stream conn;
46 if (!conn.open(m_serverAddr, 2, 10)) {
47 printf("connect %s error %s\r\n", m_serverAddr.c_str(),
48 acl::last_serror());
49 } else {
50 doEcho(conn);
51 }
52#endif
53
54 m_hWin.OnFiberConnectExit(this);
55}
56
57void CFiberConnect::doEcho(socket_t sock)
58{

Callers

nothing calls this directly

Calls 7

acl_fiber_socketFunction · 0.85
acl_fiber_connectFunction · 0.85
acl_fiber_closeFunction · 0.85
OnFiberConnectExitMethod · 0.80
last_serrorFunction · 0.50
c_strMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected