Extend datagram socket API.

Adds .setTargetAddress() and makes .getXAddress() work for datagram sockets, too.
This commit is contained in:
Sönke Ludwig 2017-03-10 22:46:43 +01:00
parent 2e5b13ee98
commit 1d330d6330
No known key found for this signature in database
GPG key ID: D95E8DB493EE314C
3 changed files with 15 additions and 6 deletions

View file

@ -157,10 +157,10 @@ interface EventDriverSockets {
ConnectionState getConnectionState(StreamSocketFD sock);
/// Retrieves the bind address of a socket.
bool getLocalAddress(StreamSocketFD sock, scope RefAddress dst);
bool getLocalAddress(SocketFD sock, scope RefAddress dst);
/// Retrieves the address of the connected peer.
bool getRemoteAddress(StreamSocketFD sock, scope RefAddress dst);
bool getRemoteAddress(SocketFD sock, scope RefAddress dst);
/// Sets the `TCP_NODELAY` option on a socket
void setTCPNoDelay(StreamSocketFD socket, bool enable);
@ -248,6 +248,10 @@ interface EventDriverSockets {
*/
DatagramSocketFD adoptDatagramSocket(int socket);
/** Sets an address to use as the default target address for sent datagrams.
*/
void setTargetAddress(DatagramSocketFD socket, scope Address target_address);
/// Sets the `SO_BROADCAST` socket option.
bool setBroadcast(DatagramSocketFD socket, bool enable);