APR::Socket - Perl API for XXX
use APR::Socket ();
META: to be completed
APR::Socket provides the following functions and/or methods:
APR::Socket
bind
META: Autogenerated - needs to be reviewed/completed
Bind the socket to its associated port
$ret = $sock->bind($sa);
$sock
The socket to bind
$sa
APR::SockAddr
The socket address to bind to
$ret
This may be where we will find out if there is any other process using the selected port.
close
Close a socket.
$ret = $thesocket->close();
$thesocket
The socket to close
connect
Issue a connection request to a socket either on the same machine or a different one.
$ret = $sock->connect($sa);
The socket we wish to use for our side of the connection
The address of the machine we wish to connect to. If NULL, APR assumes that the sockaddr_in in the apr_socket is completely filled out.
listen
Listen to a bound socket for connections.
$ret = $sock->listen($backlog);
The socket to listen on
$backlog
The number of outstanding connections allowed in the sockets listen queue. If this value is less than zero, the listen queue size is set to zero.
opt_get
Query socket options for the specified socket
$ret = $sock->opt_get($opt, $on);
The socket to query
$opt
The option we would like to query. One of:
APR::SO_DEBUG -- turn on debugging information APR::SO_KEEPALIVE -- keep connections active APR::SO_LINGER -- lingers on close if data is present APR::SO_NONBLOCK -- Turns blocking on/off for socket APR::SO_REUSEADDR -- The rules used in validating addresses supplied to bind should allow reuse of local addresses. APR::SO_SNDBUF -- Set the SendBufferSize APR::SO_RCVBUF -- Set the ReceiveBufferSize APR::SO_DISCONNECTED -- Query the disconnected state of the socket. (Currently only used on Windows)
$on
Socket option returned on the call.
opt_set
Setup socket options for the specified socket
$ret = $sock->opt_set($opt, $on);
The socket to set up.
The option we would like to configure. One of:
APR::SO_DEBUG -- turn on debugging information APR::SO_KEEPALIVE -- keep connections active APR::SO_LINGER -- lingers on close if data is present APR::SO_NONBLOCK -- Turns blocking on/off for socket APR::SO_REUSEADDR -- The rules used in validating addresses supplied to bind should allow reuse of local addresses. APR::SO_SNDBUF -- Set the SendBufferSize APR::SO_RCVBUF -- Set the ReceiveBufferSize
Value for the option.
recvfrom
$ret = $from->recvfrom($sock, $flags, $buf, $len);
$from
The apr_sockaddr_t to fill in the recipient info
The socket to use
$flags
The flags to use
$buf
The buffer to use
$len
The length of the available buffer
sendto
$ret = $sock->sendto($where, $flags, $buf, $len);
The socket to send from
$where
The apr_sockaddr_t describing where to send the data
The data to send
The length of the data to send
timeout_set
Setup socket timeout for the specified socket
$ret = $sock->timeout_set($t);
$t
Value for the timeout:
t > 0 -- read and write calls return APR::TIMEUP if specified time elapsess with no data read or written t == 0 -- read and write calls never block t < 0 -- read and write calls block
mod_perl 2.0 documentation.
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 1.1.
The mod_perl development team and numerous contributors.
To install mod_perl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm mod_perl
CPAN shell
perl -MCPAN -e shell install mod_perl
For more information on module installation, please visit the detailed CPAN module installation guide.