vibe.d beta banner
get vibe.d
0.10.0

Asynchronous I/O that doesn’t get in your way, written in D

Function EventDriverSockets.getRemoteAddress

Retrieves the address of the connected peer.

abstract bool getRemoteAddress (
  SocketFD sock,
  scope RefAddress dst
) nothrow @safe;

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);
Authors
Copyright
License