VgaGames4

VgaGames4 - network man-pages

[.. upper level ..]

# vg4->nw->numberofclients()

Return number of clients (still connected or not).

SYNTAX
int vg4->nw->numberofclients(int *conncl)
FUNCTION PARAMETERS

conncl | For returning number of connected clients, if not NULL

RETURN VALUE
Returns the number of clients
DESCRIPTION
Return number of clients (still connected or not). The client-numbers of all clients are in a ascending order, beginning with 1. So the return-value of this function is as well the highest client-number. If the parameter conncl is not NULL, it returns the number of clients which are still connected, taken from the last known state received with vg4->nw->update().
EXAMPLE

    /* iterate over all clients */
    int icl, clmax, conncl;

    clmax = vg4->nw->numberofclients(&conncl);

    printf("Highest client-number is %d. Still connected are %d.\n", clmax, conncl);

    for (icl = 1; icl <= clmax; icl++) {
      if (!vg4->nw->is_connected(icl)) { continue; }  /* not connected */
      /* use client with client-number icl */
    }

SEE ALSO
vg4->nw->connect() vg4->nw->is_connected()