Chapter 32. Networking

accept newsocket, listeningsocket

Accepts a new socket. If newsocket is an uninitialized scalar variable, a new, unique handle is automatically created.

bind socket, name

Binds the name to the socket.

connect socket, name

Connects a socket to the named peer.

getpeername socket

Returns the socket address of the other end of the socket.

getsockname socket

Returns the name of the socket.

getsockopt socket, level, optname

Returns the socket options.

listen socket, queuesize

Starts listening on the specified socket, allowing queuesize connections.

recv socket, $var, length, flags

Receives a message of length characters on the socket and puts it into scalar variable $var.

send socket, msg, flags [ , to ]

Sends a message on the socket.

setsockopt socket, level, optname, optval

Sets the requested socket option.

shutdown socket, how

Shuts the socket down.

socket socket, domain, type, protocol

Creates a socket in the domain with the given type and protocol. If socket is an uninitialized scalar variable, a new, unique handle is created.

socketpair socket1, socket2, domain, type, protocol

Works the same as socket, but creates a pair of bidirectional sockets.

Get Perl Pocket Reference, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.