Fixes sockets2 on Windows.
This commit is contained in:
parent
25f6e0c681
commit
0d263f155b
1 changed files with 10 additions and 1 deletions
|
|
@ -17,7 +17,6 @@ when hostos == "solaris":
|
||||||
|
|
||||||
when defined(Windows):
|
when defined(Windows):
|
||||||
import winlean
|
import winlean
|
||||||
export ioctlsocket
|
|
||||||
else:
|
else:
|
||||||
import posix
|
import posix
|
||||||
export fcntl, F_GETFL, O_NONBLOCK, F_SETFL
|
export fcntl, F_GETFL, O_NONBLOCK, F_SETFL
|
||||||
|
|
@ -66,6 +65,16 @@ type
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
let
|
let
|
||||||
osInvalidSocket* = winlean.INVALID_SOCKET
|
osInvalidSocket* = winlean.INVALID_SOCKET
|
||||||
|
|
||||||
|
const
|
||||||
|
IOCPARM_MASK* = 127
|
||||||
|
IOC_IN* = int(-2147483648)
|
||||||
|
FIONBIO* = IOC_IN.int32 or ((sizeof(int32) and IOCPARM_MASK) shl 16) or
|
||||||
|
(102 shl 8) or 126
|
||||||
|
|
||||||
|
proc ioctlsocket*(s: TSocketHandle, cmd: clong,
|
||||||
|
argptr: ptr clong): cint {.
|
||||||
|
stdcall, importc: "ioctlsocket", dynlib: "ws2_32.dll".}
|
||||||
else:
|
else:
|
||||||
let
|
let
|
||||||
osInvalidSocket* = posix.INVALID_SOCKET
|
osInvalidSocket* = posix.INVALID_SOCKET
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue