On Thu, 25 Apr 2013, silvioprog wrote:
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...
Yes, but the above is what I mean with 'it does not make much sense'.I can easily add this - in fact I will do so, but with multiple sockets it is better to combine the waitfordata()
Michael.
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal