MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / socket

Function socket

net/basic_socket.cpp:75–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75int socket(int domain, int type, int protocol) {
76#ifdef __APPLE__
77 auto fd = ::socket(domain, type, protocol);
78 set_fd_nonblocking(fd);
79 int val = 1;
80 ::setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, (void*)&val, sizeof(val));
81 return fd;
82#else
83 return ::socket(domain, type | SOCK_NONBLOCK, protocol);
84#endif
85}
86int connect(int fd, const struct sockaddr *addr, socklen_t addrlen,
87 Timeout timeout) {
88 int err = 0;

Callers 7

initMethod · 0.70
gethostbypeerFunction · 0.70
test_socket_serverFunction · 0.50
TESTFunction · 0.50
serverFunction · 0.50
tcp_serverFunction · 0.50
tcp_clientFunction · 0.50

Calls 1

set_fd_nonblockingFunction · 0.85

Tested by 4

test_socket_serverFunction · 0.40
TESTFunction · 0.40
tcp_serverFunction · 0.40
tcp_clientFunction · 0.40