Socket

Class for creating a network communication endpoint using the Berkeley sockets interfaces of different types.

Constructors

this
this(socket_t handle, AddressFamily af)

Create a socket.

Destructor

~this
~this()

Closes the socket and calls the destructor on itself.

Members

Enums

Shutdown
enum Shutdown

How a socket is shutdown.

Shutdown
enum Shutdown

How a socket is shutdown.

Functions

close
void close()

Immediately drop any connections and release socket resources. Calling $(D_PSYMBOL shutdown) before $(D_PSYMBOL close) is recommended for connection-oriented sockets. The $(D_PSYMBOL Socket) object is no longer usable after $(D_PSYMBOL close).

getOption
int getOption(SocketOptionLevel level, SocketOption option, void[] result)
int getOption(SocketOptionLevel level, SocketOption option, size_t result)
int getOption(SocketOptionLevel level, SocketOption option, Linger result)
int getOption(SocketOptionLevel level, SocketOption option, Duration result)

Get a socket option.

listen
void listen(int backlog)

Listen for an incoming connection. $(D_PSYMBOL bind) must be called before you can $(D_PSYMBOL listen).

opCmp
int opCmp(size_t that)

Compare handles.

setOption
void setOption(SocketOptionLevel level, SocketOption option, void[] value)
void setOption(SocketOptionLevel level, SocketOption option, size_t value)
void setOption(SocketOptionLevel level, SocketOption option, Linger value)
void setOption(SocketOptionLevel level, SocketOption option, Duration value)

Set a socket option.

shutdown
void shutdown(Shutdown how)

Disables sends and/or receives.

Properties

addressFamily
AddressFamily addressFamily [@property getter]
blocking
inout(bool) blocking [@property getter]
blocking
bool blocking [@property setter]
handle
inout(socket_t) handle [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
isAlive
bool isAlive [@property getter]

Variables

family
AddressFamily family;

Address family.

handle_
socket_t handle_;

Socket handle.

Meta