February 2012
Intermediate to advanced
1184 pages
37h 17m
English
bindSOCKET,NAME
This function assigns a name to an unnamed but already-opened
socket specified by the SOCKET filehandle so
that other processes can find it. The function returns true if it
succeeded, false otherwise. NAME should be a
packed address of the proper type for the socket.
use Socket; $port_number = 80; # pretend we want to be a web server $sockaddr = sockaddr_in($port_number, INADDR_ANY); bind(SOCK, $sockaddr) || die "Can't bind $port_number: $!";
See bind(2). See also the examples in the
section “Sockets” in Chapter 15. Normally, you should
be using the higher-level interface to sockets provided by the standard
IO::Socket module.
Read now
Unlock full access