DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Developing SMUX peers for SNMP agents

Main loop

At this point, the peer program is in its main loop.

for (;;) {
    int             n, secs;
    fd_set          rfds, wfds;

secs = NOTOK; rfds = ifds; /* struct copy */ wfds = ofds;

if (smux_fd == NOTOK && !dont_bother_anymore) secs = 5 * 60L; else if (rock_and_roll) FD_SET(smux_fd, &rfds); else FD_SET(smux_fd, &wfds); if (smux_fd >= nfds) nfds = smux_fd + 1;

if ((n = xselect(nfds, &rfds, &wfds, NULLFD, secs)) == NOTOK) { LIB_PERROR("failed, xselect"); exit(-1); }

if (smux_fd == NOTOK && !dont_bother_anymore) { if (n == 0) { if ((smux_fd = smux_init(debug)) == NOTOK) LIB_ERROR2("smux_init: %s [%s]", smux_error(smux_errno),smux_info); else rock_and_roll = 0; } } else if (rock_and_roll) { if (FD_ISSET(smux_fd, &rfds)) doit_smux(); } else if (FD_ISSET(smux_fd, &wfds)) start_smux(); }


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005