MCPcopy Create free account
hub / github.com/Tencent/UnLua / inet_trycreate

Function inet_trycreate

Plugins/UnLuaExtensions/LuaSocket/Source/src/inet.cpp:353–360  ·  view source on GitHub ↗

-------------------------------------------------------------------------*\ * Tries to create a new inet socket \*-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

351* Tries to create a new inet socket
352\*-------------------------------------------------------------------------*/
353const char *inet_trycreate(p_socket ps, int family, int type, int protocol) {
354 const char *err = socket_strerror(socket_create(ps, family, type, protocol));
355 if (err == NULL && family == AF_INET6) {
356 int yes = 1;
357 setsockopt(*ps, IPPROTO_IPV6, IPV6_V6ONLY, (const char *)&yes, sizeof(yes));
358 }
359 return err;
360}
361
362/*-------------------------------------------------------------------------*\
363* "Disconnects" a DGRAM socket

Callers 5

inet_tryconnectFunction · 0.85
inet_trybindFunction · 0.85
meth_sendtoFunction · 0.85
udp_createFunction · 0.85
tcp_createFunction · 0.85

Calls 2

socket_strerrorFunction · 0.70
socket_createFunction · 0.70

Tested by

no test coverage detected