diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-02-18 09:56:01 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-02-18 09:56:01 +0100 |
commit | c8e33cbb75caf21a76d379ce94b42baffbefa73f (patch) | |
tree | 2382ee25980be7fa3e89a1a5483cb78857463115 /lib/pure/asyncnet.nim | |
parent | 9e754c3b0623433380de171d25bfb862eb2f9ab7 (diff) | |
parent | 8b39551fca81e95b51393a2a8e702eebe3ba7c51 (diff) | |
download | Nim-c8e33cbb75caf21a76d379ce94b42baffbefa73f.tar.gz |
fixed merge conflict
Diffstat (limited to 'lib/pure/asyncnet.nim')
-rw-r--r-- | lib/pure/asyncnet.nim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim index 1c0681fad..56bda737a 100644 --- a/lib/pure/asyncnet.nim +++ b/lib/pure/asyncnet.nim @@ -166,6 +166,18 @@ proc newAsyncSocket*(domain: Domain = AF_INET, sockType: SockType = SOCK_STREAM, raiseOSError(osLastError()) result = newAsyncSocket(fd, domain, sockType, protocol, buffered) +proc getLocalAddr*(socket: AsyncSocket): (string, Port) = + ## Get the socket's local address and port number. + ## + ## This is high-level interface for `getsockname`:idx:. + getLocalAddr(socket.fd, socket.domain) + +proc getPeerAddr*(socket: AsyncSocket): (string, Port) = + ## Get the socket's peer address and port number. + ## + ## This is high-level interface for `getpeername`:idx:. + getPeerAddr(socket.fd, socket.domain) + proc newAsyncSocket*(domain, sockType, protocol: cint, buffered = true): AsyncSocket = ## Creates a new asynchronous socket. |