Perl Programming/Keywords/socket
< Perl Programming | Keywords
The socket keywordEdit
The socket function opens a socket of the specified kind and attaches it to filehandle SOCKET. The DOMAIN, TYPE, and PROTOCOL are specified in the same way as for syscall.
SyntaxEdit
socket SOCKET, DOMAIN, TYPE, PROTOCOL
ExamplesEdit
use Socket;
$proto = getprotobyname("tcp");
socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";