From 989024b2930993199cf9a2e2e9aa23c28f7d7548 Mon Sep 17 00:00:00 2001 From: pierre Date: Wed, 21 Jun 2000 22:26:47 +0000 Subject: [PATCH] * use ioctlsocket in fdRead --- rtl/win32/sockets.pp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/rtl/win32/sockets.pp b/rtl/win32/sockets.pp index df89842883..0e4e0ce5ff 100644 --- a/rtl/win32/sockets.pp +++ b/rtl/win32/sockets.pp @@ -190,8 +190,21 @@ function fdRead(handle : longint;var bufptr;size : dword) : dword; d : dword; begin - if not(Windows.ReadFile(handle,bufptr,size,d,nil)) then - SocketError:=Windows.GetLastError + if ioctlsocket(handle,FIONREAD,@d)<>0 then + begin + SocketError:=WSAGetLastError; + fdRead:=0; + exit; + end; + if d>0 then + begin + if size>d then + size:=d; + if not(Windows.ReadFile(handle,bufptr,size,d,nil)) then + SocketError:=Windows.GetLastError + else + SocketError:=0; + end else SocketError:=0; fdRead:=d; @@ -211,7 +224,10 @@ finalization end. { $Log$ - Revision 1.6 2000-06-19 13:32:18 michael + Revision 1.7 2000-06-21 22:26:47 pierre + * use ioctlsocket in fdRead + + Revision 1.6 2000/06/19 13:32:18 michael + Corrected GetSocketOptions Revision 1.5 2000/02/09 16:59:34 peter @@ -223,4 +239,4 @@ end. Revision 1.3 2000/01/07 16:32:34 daniel * copyright 2000 added -} +} \ No newline at end of file