请教关于TTimeVal类和TFDSet类的说明和用法。肯定会给分!!!(50分)

  • 主题发起人 panchenglin
  • 开始时间
P

panchenglin

Unregistered / Unconfirmed
GUEST, unregistred user!
请教关于TTimeVal类和TFDSet类的说明和用法。肯定会给分!!!
{自定义函数: 判断是否可以读数据}
function TXSocket.CanRead(aTimeOut: Integer): integer;
var
FDSet : TFDSet;
TimeVal : TTimeVal;
begin
TimeVal.tv_sec := aTimeout div 1000;
TimeVal.tv_usec := (aTimeout mod 1000) * 1000;
FD_ZERO(FDSet);
FD_SET(m_Socket, FDSet);
result := select(0, @FDSet, nil, nil, @TimeVal);// 若返回0则说明读数据超时
end;
 

Similar threads

S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
933
SUNSTONE的Delphi笔记
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
顶部 底部