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

Function acl_socket_init

lib_acl/src/stdlib/sys/acl_sys_socket.c:91–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89static int __socket_ended = 0;
90
91int acl_socket_init(void)
92{
93 const char *myname = "acl_socket_init";
94 WORD version = 0;
95 WSADATA data;
96
97 if (__socket_inited) {
98 acl_msg_warn("%s(%d): has been inited", myname, __LINE__);
99 return 0;
100 }
101
102 __socket_inited = 1;
103
104 FillMemory(&data, sizeof(WSADATA), 0);
105
106 version = MAKEWORD(2, 0);
107
108 if (WSAStartup(version, &data) != 0) {
109 acl_msg_error("%s(%d): WSAStartup error(%s)",
110 myname, __LINE__, acl_last_serror());
111 return -1;
112 }
113 if (LOBYTE(data.wVersion) != 2 || HIBYTE(data.wVersion) != 0) {
114 WSACleanup();
115 acl_msg_error("%s(%d): LOBYTE(data.wVersion) = %d"
116 ", HIBYTE(data.wVersion) = %d", myname, __LINE__,
117 LOBYTE(data.wVersion), HIBYTE(data.wVersion));
118 return -1;
119 }
120
121 __socket_ended = 0;
122 return (0);
123}
124
125int acl_socket_end(void)
126{

Callers 8

mainFunction · 0.85
initFunction · 0.85
initFunction · 0.85
proctl_initFunction · 0.85
acl_lib_initFunction · 0.85
initFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 3

acl_msg_warnFunction · 0.85
acl_msg_errorFunction · 0.85
acl_last_serrorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…