50,523
社区成员
发帖
与我相关
我的任务
分享
struct nn_pollfd {
int fd;
short events;
short revents;
};
int nn_poll (struct nn_pollfd *fds, int nfds, int timeout);
public class nn_pollfd extends Structure{
public int fd;
public short events;
public short revents;
}
int nn_poll (nn_pollfd fds, int nfds, int timeout);
struct nn_polld pfd [2];
pfd [0].fd = s1;
pfd [0].events = NN_POLLIN | NN_POLLOUT;
pfd [1].fd = s2;
pfd [1].events = NN_POLLIN;
rc = nn_poll (pfd, 2, 2000);
if (rc == 0) {
printf ("Timeout!");
exit (1);
}
if (rc == -1) {
printf ("Error!");
exit (1);
}
if (pfd [0].revents & NN_POLLIN) {
printf ("Message can be received from s1!");
exit (1);
}