View source code Display the source code in std/socket.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

Module std.socket

Socket primitives.

Example

See /dmd/samples/d/listener.d and /dmd/samples/d/htmlget.d

Functions

Name Description
getAddress Provides protocol-independent translation from host names to socket addresses. Uses getAddressInfo if the current system supports it, and InternetHost otherwise.
getAddressInfo Provides protocol-independent translation from host names to socket addresses. If advanced functionality is not required, consider using getAddress for compatibility with older systems.
lastSocketError Retrieve the error message for the most recently encountered network error.
parseAddress 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 Creates a pair of connected sockets.
wouldHaveBlocked Return true if the last socket operation failed because the socket

Classes

Name Description
Address Address is an abstract class for representing a socket addresses.
AddressException Class for exceptions thrown from an Address.
HostException Class for exceptions thrown from an InternetHost.
Internet6Address Internet6Address encapsulates an IPv6 (Internet Protocol version 6) socket address.
InternetAddress InternetAddress encapsulates an IPv4 (Internet Protocol version 4) socket address.
InternetHost InternetHost is a class for resolving IPv4 addresses.
Protocol Protocol is a class for retrieving protocol information.
Service Service is a class for retrieving service information.
Socket Socket is a class that creates a network communication endpoint using the Berkeley sockets interface.
SocketAcceptException Class for exceptions thrown by Socket.accept.
SocketException Base exception thrown by std.socket.
SocketFeatureException Socket exceptions representing attempts to use network capabilities not
SocketOSException Socket exceptions representing network errors reported by the operating
SocketParameterException Socket exceptions representing invalid parameters specified by user code.
SocketSet A collection of sockets for use with Socket.select.
TcpSocket TcpSocket is a shortcut class for a TCP Socket.
UdpSocket UdpSocket is a shortcut class for a UDP Socket.
UnixAddress UnixAddress encapsulates an address for a Unix domain socket (AF_UNIX). Available only on supported systems.
UnknownAddress UnknownAddress encapsulates an unknown socket address.
UnknownAddressReference UnknownAddressReference encapsulates a reference to an arbitrary socket address.

Structs

Name Description
AddressInfo Holds information about a socket address retrieved by getAddressInfo.
Linger Linger information for use with SocketOption.LINGER.
TimeVal Duration timeout value.

Enums

Name Description
AddressFamily The communication domain used to resolve an address.
AddressInfoFlags Specifies option flags for getAddressInfo.
ProtocolType Protocol
SocketFlags Flags may be OR'ed together:
SocketOption Specifies a socket option:
SocketOptionLevel The level at which a socket option is defined:
SocketShutdown How a socket is shutdown:
SocketType Communication semantics

Authors

Christopher E. Miller, David Nadlinger, Vladimir Panteleev

License

Boost License 1.0.

Comments