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.
Params:
socket: Socket file descriptor to adopt
socket = Socket file descriptor to adopt
Returns:
Returns a socket handle corresponding to the passed socket
@ -157,10 +157,32 @@ interface EventDriverSockets {
/// Determines the current connection state.
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);
/// 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);
/// Sets the `TCP_NODELAY` option on a socket
@ -223,9 +245,9 @@ interface EventDriverSockets {
/** Creates a connection-less datagram socket.
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.
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
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.
Params:
socket: Socket file descriptor to adopt
socket = Socket file descriptor to adopt
Returns:
Returns a socket handle corresponding to the passed socket
@ -393,9 +415,9 @@ interface EventDriverSignals {
disabled by using this function.
Params:
sig: The number of the signal to listen for
on_signal: Callback that gets called whenever a matching signal gets
received
sig = The number of the signal to listen for
on_signal = Callback that gets called whenever a matching signal
gets received
Returns:
Returns an identifier that identifies the resource associated with