parent
d24b6667c6
commit
1a2351f95f
7 changed files with 76 additions and 19 deletions
|
|
@ -184,13 +184,13 @@ proc toSockType*(protocol: Protocol): SockType =
|
|||
of IPPROTO_IP, IPPROTO_IPV6, IPPROTO_RAW, IPPROTO_ICMP:
|
||||
SOCK_RAW
|
||||
|
||||
proc newNativeSocket*(domain: Domain = AF_INET,
|
||||
proc createNativeSocket*(domain: Domain = AF_INET,
|
||||
sockType: SockType = SOCK_STREAM,
|
||||
protocol: Protocol = IPPROTO_TCP): SocketHandle =
|
||||
## Creates a new socket; returns `osInvalidSocket` if an error occurs.
|
||||
socket(toInt(domain), toInt(sockType), toInt(protocol))
|
||||
|
||||
proc newNativeSocket*(domain: cint, sockType: cint,
|
||||
proc createNativeSocket*(domain: cint, sockType: cint,
|
||||
protocol: cint): SocketHandle =
|
||||
## Creates a new socket; returns `osInvalidSocket` if an error occurs.
|
||||
##
|
||||
|
|
@ -198,6 +198,26 @@ proc newNativeSocket*(domain: cint, sockType: cint,
|
|||
## not contain what you need.
|
||||
socket(domain, sockType, protocol)
|
||||
|
||||
proc newNativeSocket*(domain: Domain = AF_INET,
|
||||
sockType: SockType = SOCK_STREAM,
|
||||
protocol: Protocol = IPPROTO_TCP): SocketHandle
|
||||
{.deprecated.} =
|
||||
## Creates a new socket; returns `osInvalidSocket` if an error occurs.
|
||||
##
|
||||
## **Deprecated since v0.18.0:** Use ``createNativeSocket`` instead.
|
||||
createNativeSocket(domain, sockType, protocol)
|
||||
|
||||
proc newNativeSocket*(domain: cint, sockType: cint,
|
||||
protocol: cint): SocketHandle
|
||||
{.deprecated.} =
|
||||
## Creates a new socket; returns `osInvalidSocket` if an error occurs.
|
||||
##
|
||||
## Use this overload if one of the enums specified above does
|
||||
## not contain what you need.
|
||||
##
|
||||
## **Deprecated since v0.18.0:** Use ``createNativeSocket`` instead.
|
||||
createNativeSocket(domain, sockType, protocol)
|
||||
|
||||
proc close*(socket: SocketHandle) =
|
||||
## closes a socket.
|
||||
when useWinVersion:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue