Add example to get(Local/Remove)Address and fix some ddoc syntax errors.

This commit is contained in:
Sönke Ludwig 2017-08-12 21:25:27 +02:00
parent ee09a4068e
commit dd873ec6cf
No known key found for this signature in database
GPG key ID: D95E8DB493EE314C

View file

@ -135,7 +135,7 @@ interface EventDriverSockets {
operations. operations.
Params: Params:
socket: Socket file descriptor to adopt socket = Socket file descriptor to adopt
Returns: Returns:
Returns a socket handle corresponding to the passed socket Returns a socket handle corresponding to the passed socket
@ -157,10 +157,32 @@ interface EventDriverSockets {
/// Determines the current connection state. /// Determines the current connection state.
ConnectionState getConnectionState(StreamSocketFD sock); ConnectionState getConnectionState(StreamSocketFD sock);
/// Retrieves the bind address of a socket. /** Retrieves the bind address of a socket.
Example:
The following code can be used to retrieve an IPv4/IPv6 address
allocated on the stack. Note that Unix domain sockets require a larger
buffer (e.g. `sockaddr_storage`).
---
scope storage = new UnknownAddress;
scope sockaddr = new RefAddress(storage.name, storage.nameLen);
eventDriver.sockets.getLocalAddress(sock, sockaddr);
---
*/
bool getLocalAddress(SocketFD sock, scope RefAddress dst); bool getLocalAddress(SocketFD sock, scope RefAddress dst);
/// Retrieves the address of the connected peer. /** Retrieves the address of the connected peer.
Example:
The following code can be used to retrieve an IPv4/IPv6 address
allocated on the stack. Note that Unix domain sockets require a larger
buffer (e.g. `sockaddr_storage`).
---
scope storage = new UnknownAddress;
scope sockaddr = new RefAddress(storage.name, storage.nameLen);
eventDriver.sockets.getLocalAddress(sock, sockaddr);
---
*/
bool getRemoteAddress(SocketFD sock, scope RefAddress dst); bool getRemoteAddress(SocketFD sock, scope RefAddress dst);
/// Sets the `TCP_NODELAY` option on a socket /// Sets the `TCP_NODELAY` option on a socket
@ -223,9 +245,9 @@ interface EventDriverSockets {
/** Creates a connection-less datagram socket. /** Creates a connection-less datagram socket.
Params: Params:
bind_address: The local bind address to use for the socket. It bind_address = The local bind address to use for the socket. It
will be able to receive any messages sent to this address. will be able to receive any messages sent to this address.
target_address: Optional default target address. If this is target_address = Optional default target address. If this is
specified and the target address parameter of `send` is specified and the target address parameter of `send` is
left to `null`, it will be used instead. left to `null`, it will be used instead.
@ -240,7 +262,7 @@ interface EventDriverSockets {
The socket must be properly bound before this function is called. The socket must be properly bound before this function is called.
Params: Params:
socket: Socket file descriptor to adopt socket = Socket file descriptor to adopt
Returns: Returns:
Returns a socket handle corresponding to the passed socket Returns a socket handle corresponding to the passed socket
@ -393,9 +415,9 @@ interface EventDriverSignals {
disabled by using this function. disabled by using this function.
Params: Params:
sig: The number of the signal to listen for sig = The number of the signal to listen for
on_signal: Callback that gets called whenever a matching signal gets on_signal = Callback that gets called whenever a matching signal
received gets received
Returns: Returns:
Returns an identifier that identifies the resource associated with Returns an identifier that identifies the resource associated with