The OpenD Programming Language

std.socket

Socket primitives.

Public Imports

core.sys.windows.winsock2
public import core.sys.windows.winsock2;
Undocumented in source.
core.sys.posix.netinet.in_
public import core.sys.posix.netinet.in_;
Undocumented in source.

Members

Classes

Address
class Address

Abstract class for representing a socket address.

AddressException
class AddressException

Class for exceptions thrown from an Address.

HostException
class HostException

Class for exceptions thrown from an InternetHost.

Internet6Address
class Internet6Address

Encapsulates an IPv6 (Internet Protocol version 6) socket address.

InternetAddress
class InternetAddress

Encapsulates an IPv4 (Internet Protocol version 4) socket address.

InternetHost
class InternetHost

Class for resolving IPv4 addresses.

Protocol
class Protocol

Class for retrieving protocol information.

Service
class Service

Class for retrieving service information.

Socket
class Socket

Class that creates a network communication endpoint using the Berkeley sockets interface.

SocketAcceptException
class SocketAcceptException

Exception thrown by Socket.accept.

SocketException
class SocketException

Base exception thrown by std.socket.

SocketFeatureException
class SocketFeatureException

Socket exception representing attempts to use network capabilities not available on the current system.

SocketOSException
class SocketOSException

Socket exception representing network errors reported by the operating system.

SocketParameterException
class SocketParameterException

Socket exception representing invalid parameters specified by user code.

SocketSet
class SocketSet

A collection of sockets for use with Socket.select.

TcpSocket
class TcpSocket

Shortcut class for a TCP Socket.

UdpSocket
class UdpSocket

Shortcut class for a UDP Socket.

UnixAddress
class UnixAddress

Encapsulates an address for a Unix domain socket (AF_UNIX), i.e. a socket bound to a path name in the file system. Available only on supported systems.

UnknownAddress
class UnknownAddress

Encapsulates an unknown socket address.

UnknownAddressReference
class UnknownAddressReference

Encapsulates a reference to an arbitrary socket address.

Enums

AddressFamily
enum AddressFamily

The communication domain used to resolve an address.

AddressInfoFlags
enum AddressInfoFlags

A subset of flags supported on all platforms with getaddrinfo. Specifies option flags for getAddressInfo.

ProtocolType
enum ProtocolType

Protocol

SocketFlags
enum SocketFlags

Socket flags that may be OR'ed together:

SocketOption
enum SocketOption

Specifies a socket option:

SocketOptionLevel
enum SocketOptionLevel

The level at which a socket option is defined:

SocketShutdown
enum SocketShutdown

How a socket is shutdown:

SocketType
enum SocketType

Communication semantics

Functions

getAddress
Address[] getAddress(const(char)[] hostname, const(char)[] service)
Address[] getAddress(const(char)[] hostname, ushort port)

Provides _protocol-independent translation from host names to socket addresses. Uses getAddressInfo if the current system supports it, and InternetHost otherwise.

getAddressInfo
AddressInfo[] getAddressInfo(const(char)[] node, T options)

Provides _protocol-independent translation from host names to socket addresses. If advanced functionality is not required, consider using getAddress for compatibility with older systems.

parseAddress
Address parseAddress(const(char)[] hostaddr, const(char)[] service)
Address parseAddress(const(char)[] hostaddr, ushort port)

Provides _protocol-independent parsing of network addresses. Does not attempt name resolution. Uses getAddressInfo with AddressInfoFlags.NUMERICHOST if the current system supports it, and InternetAddress otherwise.

socketPair
Socket[2] socketPair()

Creates a pair of connected sockets.

wouldHaveBlocked
bool wouldHaveBlocked()

Properties

lastSocketError
string lastSocketError [@property getter]

Returns the error message of the most recently encountered network error.

Structs

AddressInfo
struct AddressInfo

Holds information about a socket _address retrieved by getAddressInfo.

Linger
struct Linger

Linger information for use with SocketOption.LINGER.

TimeVal
struct TimeVal

Duration timeout value.

Examples

See $(SAMPLESRC listener.d) and $(SAMPLESRC htmlget.d)

Meta