Berkeley

struct Berkeley {}

Members

Aliases

ERROR
alias ERROR = Error
Undocumented in source.
setAddressReuse
alias setAddressReuse = addressReuse
Undocumented in source.
setNoDelay
alias setNoDelay = noDelay
Undocumented in source.

Enums

Error
anonymousenum Error
Undocumented in source.

Functions

accept
void accept(Berkeley target)

need to bind() first

bind
Berkeley* bind(Address addr)
connect
Berkeley* connect(Address to)
detach
void detach()

calling shutdown() before this is recommended for connection- oriented sockets

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

returns the length, in bytes, of the actual result - very different from getsockopt()

joinGroup
void joinGroup(IPv4Address address, bool onOff)

Helper function to handle the adding and dropping of group membership.

listen
Berkeley* listen(int backlog)

need to bind() first

newFamilyObject
Address newFamilyObject()
open
void open(AddressFamily family, SocketType type, ProtocolType protocol, bool create)

Configure this instance

receive
int receive(void[] buf, SocketFlags flags)

Receive data on the connection. Returns the number of bytes actually received, 0 if the remote side has closed the connection, or ERROR on failure. If the socket is blocking, receive waits until there is data to be received.

receiveFrom
int receiveFrom(void[] buf, SocketFlags flags, Address from)
int receiveFrom(void[] buf, Address from)

Receive data and get the remote endpoint Address. Returns the number of bytes actually received, 0 if the remote side has closed the connection, or ERROR on failure. If the socket is blocking, receiveFrom waits until there is data to be received.

receiveFrom
int receiveFrom(void[] buf, SocketFlags flags)

ditto - assumes you connect()ed

reopen
void reopen(socket_t sock)

Open/reopen a native socket for this instance

send
int send(const(void)[] buf, SocketFlags flags)

Send data on the connection. Returns the number of bytes actually sent, or ERROR on failure. If the socket is blocking and there is no buffer space left, send waits.

sendTo
int sendTo(const(void)[] buf, SocketFlags flags, Address to)
int sendTo(const(void)[] buf, Address to)

Send data to a specific destination Address. If the destination address is not specified, a connection must have been made and that address is used. If the socket is blocking and there is no buffer space left, sendTo waits.

sendTo
int sendTo(const(void)[] buf, SocketFlags flags)

ditto - assumes you connect()ed

setOption
Berkeley* setOption(SocketOptionLevel level, SocketOption option, const(void)[] value)
shutdown
Berkeley* shutdown(SocketShutdown how)

The shutdown function shuts down the connection of the socket. Depending on the argument value, it will:

Manifest constants

INVALID_SOCKET
enum INVALID_SOCKET;
Undocumented in source.

Properties

addressFamily
AddressFamily addressFamily [@property getter]
addressReuse
bool addressReuse [@property setter]

enable/disable address reuse

blocking
bool blocking [@property getter]

getter

blocking
bool blocking [@property setter]

setter

error
int error [@property getter]

Return socket error status

handle
socket_t handle [@property getter]

Return the underlying OS handle of this Conduit

hostAddress
uint hostAddress [@property getter]

return the default host address (IPv4)

hostName
char[] hostName [@property getter]

return the hostname

isAlive
bool isAlive [@property getter]

Is this socket still alive? A closed socket is considered to be dead, but a shutdown socket is still alive.

lastError
int lastError [@property getter]

Return the last error

linger
int linger [@property setter]

set linger timeout

localAddress
Address localAddress [@property getter]

return the local address of the current connection (IPv4)

noDelay
bool noDelay [@property setter]

enable/disable noDelay option (nagle)

remoteAddress
Address remoteAddress [@property getter]

return the remote address of the current connection (IPv4)

Static functions

badArg
void badArg(immutable(char)[] msg)
exception
void exception(immutable(char)[] msg)

Variables

family
AddressFamily family;
Undocumented in source.
protocol
ProtocolType protocol;
Undocumented in source.
sock
socket_t sock;
Undocumented in source.
synchronous
bool synchronous;
Undocumented in source.
type
SocketType type;
Undocumented in source.

Meta