summary refs log tree commit diff stats
path: root/lib/pure/sockets2.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pure/sockets2.nim')
-rw-r--r--lib/pure/sockets2.nim16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/pure/sockets2.nim b/lib/pure/sockets2.nim
index 22624bbad..031217b90 100644
--- a/lib/pure/sockets2.nim
+++ b/lib/pure/sockets2.nim
@@ -17,11 +17,13 @@ when hostos == "solaris":
 
 when defined(Windows):
   import winlean
+  export ioctlsocket
 else:
   import posix
+  export fcntl, F_GETFL, O_NONBLOCK, F_SETFL
 
 export TSocketHandle, TSockaddr_in, TAddrinfo, INADDR_ANY, TSockAddr, TSockLen,
-  inet_ntoa
+  inet_ntoa, recv, `==`, connect, send, accept
 
 type
   
@@ -63,10 +65,10 @@ type
 
 when defined(windows):
   let
-    OSInvalidSocket* = winlean.INVALID_SOCKET
+    osInvalidSocket* = winlean.INVALID_SOCKET
 else:
   let
-    OSInvalidSocket* = posix.INVALID_SOCKET
+    osInvalidSocket* = posix.INVALID_SOCKET
 
 proc `==`*(a, b: TPort): bool {.borrow.}
   ## ``==`` for ports.
@@ -89,7 +91,7 @@ when defined(posix):
     of AF_UNIX:        result = posix.AF_UNIX
     of AF_INET:        result = posix.AF_INET
     of AF_INET6:       result = posix.AF_INET6
-    else: nil
+    else: discard
 
   proc toInt(typ: TType): cint =
     case typ
@@ -97,7 +99,7 @@ when defined(posix):
     of SOCK_DGRAM:     result = posix.SOCK_DGRAM
     of SOCK_SEQPACKET: result = posix.SOCK_SEQPACKET
     of SOCK_RAW:       result = posix.SOCK_RAW
-    else: nil
+    else: discard
 
   proc toInt(p: TProtocol): cint =
     case p
@@ -107,7 +109,7 @@ when defined(posix):
     of IPPROTO_IPV6:   result = posix.IPPROTO_IPV6
     of IPPROTO_RAW:    result = posix.IPPROTO_RAW
     of IPPROTO_ICMP:   result = posix.IPPROTO_ICMP
-    else: nil
+    else: discard
 
 else:
   proc toInt(domain: TDomain): cint = 
@@ -199,4 +201,4 @@ proc htons*(x: int16): int16 =
 
 when defined(Windows):
   var wsa: TWSADATA
-  if WSAStartup(0x0101'i16, addr wsa) != 0: OSError(OSLastError())
\ No newline at end of file
+  if WSAStartup(0x0101'i16, addr wsa) != 0: OSError(OSLastError())