Adds socket creation for arbitrary domain, type and protocol.

This commit is contained in:
Dominik Picheta 2014-09-18 17:01:44 +01:00
commit 867dfbfbfa
4 changed files with 31 additions and 0 deletions

View file

@ -153,6 +153,13 @@ proc newRawSocket*(domain: Domain = AF_INET, typ: SockType = SOCK_STREAM,
## Creates a new socket; returns `InvalidSocket` if an error occurs.
socket(toInt(domain), toInt(typ), toInt(protocol))
proc newRawSocket*(domain: cint, typ: cint, protocol: cint): SocketHandle =
## Creates a new socket; returns `InvalidSocket` if an error occurs.
##
## Use this overload if one of the enums specified above does
## not contain what you need.
socket(domain, typ, protocol)
proc close*(socket: SocketHandle) =
## closes a socket.
when useWinVersion: