- void open(AddressFamily family, SocketType type, ProtocolType protocol, bool create = true) ¶#
-
Configure this instance
- void reopen(socket_t sock = sock.init) ¶#
-
Open/reopen a native socket for this instance
- void detach() ¶#
-
calling shutdown() before this is recommended for connection-
oriented sockets
- socket_t handle() ¶#
-
Return the underlying OS handle of this Conduit
- int lastError() [static] ¶#
-
Return the last error
- bool isAlive() ¶#
-
Is this socket still alive? A closed socket is considered to
be dead, but a shutdown socket is still alive.
- AddressFamily addressFamily() ¶#
-
- Berkeley* bind(Address addr) ¶#
-
- Berkeley* connect(Address to) ¶#
-
- Berkeley* listen(int backlog) ¶#
-
need to bind() first
- void accept(ref Berkeley target) ¶#
-
need to bind() first
- Berkeley* shutdown(SocketShutdown how) ¶#
-
The shutdown function shuts down the connection of the socket.
Depending on the argument value, it will:
- stop receiving data for this socket. If further data
arrives, it is rejected.
- stop trying to transmit data from this socket. Also
discards any data waiting to be sent. Stop looking for
acknowledgement of data already sent; don't retransmit
if any data is lost.
- Berkeley* linger(int period) ¶#
-
set linger timeout
- Berkeley* addressReuse(bool enabled) ¶#
-
enable/disable address reuse
- Berkeley* noDelay(bool enabled) ¶#
-
enable/disable noDelay option (nagle)
- void joinGroup(IPv4Address address, bool onOff) ¶#
-
Helper function to handle the adding and dropping of group
membership.
- Address newFamilyObject() ¶#
-
- char[] hostName() [static] ¶#
-
return the hostname
- uint hostAddress() [static] ¶#
-
return the default host address (IPv4)
- Address remoteAddress() ¶#
-
return the remote address of the current connection (IPv4)
- Address localAddress() ¶#
-
return the local address of the current connection (IPv4)
- int send(void[] buf, SocketFlags flags = SocketFlags.NONE) ¶#
-
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.
Returns number of bytes actually sent, or -1 on error
- int sendTo(void[] buf, SocketFlags flags, Address to) ¶#
- int sendTo(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.
- int sendTo(void[] buf, SocketFlags flags = SocketFlags.NONE) ¶#
-
ditto - assumes you connect()ed
- int sendTo(void[] buf, int flags, Address.sockaddr* to, int len) [private] ¶#
-
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.
- int receive(void[] buf, SocketFlags flags = SocketFlags.NONE) ¶#
-
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.
Returns number of bytes actually received, 0 on connection
closure, or -1 on error
- 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.
- int receiveFrom(void[] buf, SocketFlags flags = SocketFlags.NONE) ¶#
-
ditto - assumes you connect()ed
- int getOption(SocketOptionLevel level, SocketOption option, void[] result) ¶#
-
returns the length, in bytes, of the actual result - very
different from getsockopt()
- Berkeley* setOption(SocketOptionLevel level, SocketOption option, void[] value) ¶#
-
- bool blocking() ¶#
-
getter
- void blocking(bool yes) ¶#
-
setter
- void exception(char[] msg) [static] ¶#
-
- void badArg(char[] msg) [protected, static] ¶#
-