2013/4/25 Michael Van Canneyt <mich...@freepascal.org>

> [...]
> Well, ssockets is very low level.
>
> fpselect() is mostly useful when you combine multiple file descriptors at
> once. Although it can be done, IMHO it makes little sense to create a
> select() method on the socket stream, since it would only have one socket
> handle.
>
> You can perfectly do a fpselect() with the handles of the streams that
> ssockets uses.
>
> Michael.


Nice.

The socket of Delphi and Synapse implements WaitForData:

function TWinSocketStream.WaitForData(Timeout: Longint): Boolean;
var
  FDSet: TFDSet;
  TimeVal: TTimeVal;
begin
  TimeVal.tv_sec := Timeout div 1000;
  TimeVal.tv_usec := (Timeout mod 1000) * 1000;
  FD_ZERO(FDSet);
  FD_SET(FSocket.SocketHandle, FDSet);
  Result := select(0, @FDSet, nil, nil, @TimeVal) > 0;
end;

I do not know where it would be used, it's just an observation hehe...
-- 
Silvio Clécio
My public projects - github.com/silvioprog
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to