socket(2) creates a socket, connect(2) connects a socket to a remote socket address, the bind(2) function binds a socket to a local
socket address, listen(2) tells the socket that new connections shall be accepted, and accept(2) is used to get a new socket with a
new incoming connection. socketpair(2) returns two connected anonymous sockets (implemented only for a few local families like
AF_UNIX)
It is possible to do nonblocking I/O on sockets by setting the O_NONBLOCK flag on a socket file descriptor using fcntl(2). Then all
operations that would block will (usually) return with EAGAIN (operation should be retried later); connect(2) will return EINPROGRESS
error. The user can then wait for various events via poll(2) or select(2).
man 7 socket
最新推荐文章于 2024-10-01 18:51:18 发布