I am using select ()
on the Linux / ARM platform to see that Did I get a pack of a UDP socket? I want to know how much time was left in the selected call, if it gives time before the expiration (detects the packet).
On some lines:
int wait_fd (int fd, int msec) {straight timewell tv; Fd_set rws; Tv.tv_sec = msec / 1000ul; Tv.tv_usec = (msec% 1000ul) * 1000ul; FD_ZERO (and rws); FD_SET (FD, & amp; rws); (Zero) Select (FD + 1, and RWS, Nouel, Faucet, and TV); If (FD_ISSET (FD, and RWS)) / / contains data * / MSEC = (TVTV_SC * 1000) + (TVTV V_Usek / 1000); Return (msec msec: 1); } Other {/ * No data / return / (0); }}
The safest thing is that ignores the ambiguous definition of selection ()
and give yourself time.
Just get the time before and after the selection and subtract from the interval you wanted.
Comments
Post a Comment