<div dir="ltr">2013/4/25 Michael Van Canneyt <span dir="ltr"><<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>></span><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">[...]</div></div>
Well, ssockets is very low level.<br>
<br>
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.<br>
<br>
You can perfectly do a fpselect() with the handles of the streams that ssockets uses.<span class=""><font color="#888888"><br>
<br>
Michael.</font></span></blockquote></div><div><br></div><div style>Nice.</div><div style><br></div><div style>The socket of Delphi and Synapse implements WaitForData:</div><div style><br></div><div style><div>function TWinSocketStream.WaitForData(Timeout: Longint): Boolean;</div>
<div>var</div><div> FDSet: TFDSet;</div><div> TimeVal: TTimeVal;</div><div>begin</div><div> TimeVal.tv_sec := Timeout div 1000;</div><div> TimeVal.tv_usec := (Timeout mod 1000) * 1000;</div><div> FD_ZERO(FDSet);</div>
<div> FD_SET(FSocket.SocketHandle, FDSet);</div><div> Result := select(0, @FDSet, nil, nil, @TimeVal) > 0;</div><div>end;</div><div><br></div></div><div>I do not know where it would be used, it's just an observation hehe...<br>
</div>-- <br>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a>
</div></div>