Networking


StatementFunction

accept(s, addr, len)

Allows the server to accept a connection.

bind(s, port)

Allows the server to bind the socket to an agreed-upon address.

connect(s, port)

Allows the client to connect its socket to the server's socket.

getpeername(s)

Gets the socket address for the other end of the socket connection.

getsockname(s, name)

Gets the socket name for a specified socket.

getsockopt(socket, level, optname)

Gets the option optname for the specified socket.

listen(s, n)

Indicates that a socket is ready to listen for incoming connection requests. n specifies the maximum number of outstanding connections that can be queued awaiting acceptance by the server.

recv(s, $buf, n, flags)

Receives n bytes of data from socket s and stores the data in $buf.

send(s, $buf, n, flags)

Sends n bytes of data from $buf to socket s.

setsockopt(socket, level, optname, optval)

Sets the option optname to the value optval for the specified socket.

shutdown(s, how)

Shuts down a connection and specifies information about data subsequently sent or received.

socket(domain, type, protocol)

Creates a socket in the specified domain of the specified type using the specified protocol and returns a descriptor that can be used in later system calls operating on sockets.