The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Socket::Class::Const - Constants to Socket::Class

SYNOPSIS

  use Socket::Class qw(...);

DESCRIPTION

Socket::Class::Const contains socket related constants which can be exported. For better performance constants are declared as scalar variables.

VARIABLES

Address Family types

$AF_INET

Internet v4 address family

$AF_INET6

Internet v6 address family

$AF_BLUETOOTH

Bluetooth address family

Protocol Family types

$PF_INET

Internet protocol family. Same as $AF_INET.

$PF_INET6

Internet v6 protocol family. Same as $AF_INET6.

$PF_BLUETOOTH

Bluetooth protocol family. Same as $AF_BLUETOOTH.

Socket types

$SOCK_STREAM

Connection oriented socket

$SOCK_DGRAM

Packet oriented socket

IP (v4/v6) Protocols

$IPPROTO_ICMP

The ICMP protocol

$IPPROTO_TCP

TCP protocol. Use together with $SOCK_STREAM.

$IPPROTO_UDP

UDP protocol. Use together with $SOCK_DGRAM.

Bluetooth Protocols

$BTPROTO_RFCOMM

Stream protocol. Use together with $SOCK_STREAM.

$BTPROTO_L2CAP

Datagram protocol. Use together with $SOCK_DGRAM.

Listen queue

$SOMAXCONN

Listen queue max size.

Send, Recv Flags

$MSG_OOB

Sends OOB data (stream-style socket such as SOCK_STREAM only).

$MSG_PEEK

Peeks at the incoming data. The data is copied into the buffer, but is not removed from the input queue.

$MSG_DONTROUTE

Specifies that the data should not be subject to routing.

$MSG_CTRUNC

Data completes record.

$MSG_TRUNC

Return the real length of the packet, even when it was longer then the passed buffer. Only valid for packet sockets.

$MSG_DONTWAIT

Return even if it would normally have blocked.

$MSG_WAITALL

The receive request will complete only when one of the following events occurs:

  - The buffer supplied by the caller is completely full. 
  - The connection has been closed. 
  - The request has been canceled. 

Socket Option Levels

$SOL_SOCKET

Socket option level

$SOL_TCP

TCP option level

$SOL_UDP

UDP option level

Socket Options

$SO_ACCEPTCON

Socket is listening.

$SO_BROADCAST

The default is FALSE. This option allows transmission of broadcast messages on the socket. Valid only for protocols that support broadcasting (IPX, UDP/IPv4, and others).

$SO_DEBUG

Get or set debugging mode.

$SO_DONTROUTE

The default is FALSE. This option indicates that routing is disabled, and outgoing data should be sent on whatever interface the socket and bound to. Valid for message oriented protocols only.

$SO_ERROR

The default is zero (0). This option returns and resets the per socket–based error code.

$SO_KEEPALIVE

The default is FALSE. An application or the socket client can request that a TCP/IP service provider enable the use of keep-alive packets on TCP connections by turning on the SO_KEEPALIVE socket option.

$SO_LINGER

The default is 1 (ON). This option controls the action taken when unsent data is queued on a socket and a close() or free() is performed.

$SO_OOBINLINE

The default is FALSE. This option indicates OOB data should be returned in-line with regular data. Valid for connection oriented protocols which support out-of-band data.

$SO_RCVBUF

This option specifies the total per-socket buffer space reserved for receives.

$SO_RCVLOWAT

Receives low watermark.

$SO_RCVTIMEO

Receives time-out in milliseconds.

$SO_REUSEADDR

The default is FALSE. Allows the socket to be bound to an address that is already in use.

$SO_SNDBUF

This option specifies the total per-socket buffer space reserved for sends.

$SO_SNDLOWAT

Sends low watermark.

$SO_SNDTIMEO

Sends time-out in milliseconds.

$SO_TYPE

Get the type of the socket. (Readonly)

TCP Options

$TCP_NODELAY

Disables the Nagle algorithm for send coalescing.

Shutdown values

$SD_RECEIVE

Disable receiving on the socket.

$SD_SEND

Disable sending on the socket.

$SD_BOTH

Disable both sending and receiving on the socket.

Socket States

$SOS_INIT

Socket is created

$SOS_BOUND

Sock is bound

$SOS_LISTEN

Socket is listening

$SOS_CONNECTED

Socket is connected

$SOS_CLOSED

Socket is closed

$SOS_ERROR

Socket got an error on last send oder receive

AUTHORS

Christian Mueller <christian_at_hbr1.com>

COPYRIGHT

The Socket::Class::Const module is free software. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 311:

Non-ASCII character seen before =encoding in 'socket–based'. Assuming CP1252