#include #include #include #include "network.h" int main (int argc, char *argv[]) { int cfd; bound * rt; int len; unsigned char tbuf[8192]; rt = net_bind (NULL, 2000); if (rt == NULL) { perror ("net_bind"); exit (EXIT_FAILURE); } cfd = net_accept (rt->bs, NULL, 0); if (cfd <= 0) { perror ("net_accept"); exit (EXIT_FAILURE); } /* now deep down to the guts */ len = 1; while (len > 0 && 1) { len = read (cfd, tbuf, sizeof (tbuf)); printf ("%d\n", len); } close (cfd); net_boundfree (rt); exit (EXIT_SUCCESS); }