* windows compilation

This commit is contained in:
Ondrej Pokorny 2021-08-27 21:23:01 +02:00
parent 87e9958429
commit bbb01506c7

View File

@ -386,7 +386,7 @@ var
Include(Result,aState); Include(Result,aState);
{$endif} {$endif}
{$ifdef windows} {$ifdef windows}
if FD_IsSet(FSocket.Handle, FDS)>0 then if FD_IsSet(FSocket.Handle, FDS) then
Include(Result,aState); Include(Result,aState);
{$endif} {$endif}
end; end;
@ -407,7 +407,7 @@ begin
Res:=fpSelect(Socket.Handle + 1, PFDSR, PFDSW, PFDSE, @TimeV); Res:=fpSelect(Socket.Handle + 1, PFDSR, PFDSW, PFDSE, @TimeV);
{$endif} {$endif}
{$ifdef windows} {$ifdef windows}
Res:=Select(Socket.Handle + 1, PFDSR, PFDSW, PFDSE, @TimeV); Res:=winsock2.Select(Socket.Handle + 1, PFDSR, PFDSW, PFDSE, @TimeV);
{$endif} {$endif}
if Res>0 then if Res>0 then
begin begin
@ -549,10 +549,10 @@ var
end; end;
{$ENDIF} {$ENDIF}
{$ifdef windows} {$ifdef windows}
FD_Zero(FDS); FD_Zero(FD);
For S in AnArray do For S in AnArray do
begin begin
FD_Set(FSocket.Handle, FDS); FD_Set(S.Handle, FD);
if S.Handle>MaxHandle then if S.Handle>MaxHandle then
MaxHandle:=S.Handle; MaxHandle:=S.Handle;
end; end;
@ -566,6 +566,7 @@ var
aLen : Integer; aLen : Integer;
begin begin
Result:=nil;
SetLength(Result,Length(Src)); SetLength(Result,Length(Src));
aLen:=0; aLen:=0;
For S in Src do For S in Src do
@ -574,7 +575,7 @@ var
if fpFD_IsSet(S.Handle, FD)>0 then if fpFD_IsSet(S.Handle, FD)>0 then
{$ENDIF} {$ENDIF}
{$IFDEF Windows} {$IFDEF Windows}
if FD_isSet(FSocket.Handle, FDS)>0 then if FD_isSet(S.Handle, FD) then
{$ENDIF} {$ENDIF}
begin begin
Result[aLen]:=S; Result[aLen]:=S;
@ -600,7 +601,7 @@ begin
Result := fpSelect(MaxHandle+1, @FDR, @FDW, @FDE, @TimeV) > 0; Result := fpSelect(MaxHandle+1, @FDR, @FDW, @FDE, @TimeV) > 0;
{$endif} {$endif}
{$ifdef windows} {$ifdef windows}
Result := Select(MaxHandle+1, @FDR, @FDW, @FDE, @TimeV) > 0; Result := winsock2.Select(MaxHandle+1, @FDR, @FDW, @FDE, @TimeV) > 0;
{$endif} {$endif}
aRead:=FillArr(FDR,aRead); aRead:=FillArr(FDR,aRead);
aWrite:=FillArr(FDR,aRead); aWrite:=FillArr(FDR,aRead);
@ -798,7 +799,7 @@ begin
FDS := Default(TFDSet); FDS := Default(TFDSet);
FD_Zero(FDS); FD_Zero(FDS);
FD_Set(FSocket, FDS); FD_Set(FSocket, FDS);
Result := Select(FSocket + 1, @FDS, @FDS, @FDS, @TimeV) > 0; Result := winsock2.Select(FSocket + 1, @FDS, @FDS, @FDS, @TimeV) > 0;
{$endif} {$endif}
{$endif} {$endif}
If not Result then If not Result then
@ -1272,7 +1273,7 @@ begin
Res:=fpSelect(ASocket + 1, nil, locFDS, nil, locTimeVal); // 0 -> TimeOut Res:=fpSelect(ASocket + 1, nil, locFDS, nil, locTimeVal); // 0 -> TimeOut
{$ENDIF} {$ENDIF}
{$ifdef windows} {$ifdef windows}
Res:=select(ASocket + 1, nil, locFDS, nil, locTimeVal); // 0 -> TimeOut Res:=winsock2.select(ASocket + 1, nil, locFDS, nil, locTimeVal); // 0 -> TimeOut
{$ENDIF} {$ENDIF}
if (Res=0) then if (Res=0) then
Result:=ctrTimeout Result:=ctrTimeout