Hi guys,
just a hint to those who is about to implement socket handling on
windows. A simple function below (without any error checking though)
works fine on windows. All you need is to include it in root event loop.
Cheers,
Anton
Bool_t
TTimerSocketHandler::HandleTimer(TTimer *Timer)
{
fd_set read_set, exec_set;
int rcode;
struct timeval timeout = {0, 0};
TIter next(fSocketList);
while (TSocket *Socket = (TSocket*) next()) {
int Desc = Socket->GetDescriptor();
FD_ZERO(&read_set);
FD_ZERO(&exec_set);
FD_SET (Desc, &read_set);
FD_SET (Desc, &exec_set);
rcode = select(Desc + 1, &read_set, NULL, &exec_set, &timeout);
if (FD_ISSET((int) Desc, &read_set)) {
printf("Activity on socket!\n");
fObject->HandleSocket(Socket);
}
}
return kTRUE;
}
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:41 MET