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. Constants can be also exported as scalar variables. The export tag :all exports all constants.

CONSTANTS

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

SC_STATE_INIT

Socket is created

SC_STATE_BOUND

Sock is bound

SC_STATE_LISTEN

Socket is listening

SC_STATE_CONNECTED

Socket is connected

SC_STATE_CLOSED

Socket is closed

SC_STATE_ERROR

Socket got an error on last send oder receive

Flags for getaddrinfo()

AI_PASSIVE

The socket address will be used in a call to the bind function.

AI_CANONNAME

The canonical name is returned in the first canonname member.

AI_NUMERICHOST

The node parameter passed to the getaddrinfo function must be a numeric string.

AI_ADDRCONFIG

Windows only!

The getaddrinfo will resolve only if a global address is configured. The IPv6 and IPv4 loopback address is not considered a valid global address.

AI_NUMERICSERV

Posix only!

Don't use name resolution.

Flags for getnameinfo()

NI_NUMERICHOST

If set, then the numeric form of the hostname is returned. (When not set, this will still happen in case the node's name cannot be looked up.)

NI_NUMERICSERV

If set, then the service address is returned in numeric form, for example by its port number.

NI_NOFQDN

If set, return only the hostname part of the FQDN for local hosts.

NI_NAMEREQD

If set, then a error is returned if the hostname cannot be looked up.

NI_DGRAM

If set, then the service is datagram (UDP) based rather than stream (TCP) based. This is required for the few ports (512-514) that have different services for UDP and TCP.

AUTHORS

Christian Mueller, http://www.alien-heads.org/

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 199:

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