Using TCP Through Sockets
Using TCP Through Sockets
Using TCP Through Sockets
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
}<br />
xfree (fc->host);<br />
xfree (fc->user);<br />
xfree (fc->resp);<br />
xfree (fc);<br />
void<br />
finger_done (struct fcon *fc)<br />
{<br />
printf ("[%s]\n", fc->host);<br />
fwrite (fc->resp, 1, fc->resp_pos, stdout);<br />
fcon_free (fc);<br />
}<br />
static void<br />
finger_getresp (void *_fc)<br />
{<br />
struct fcon *fc = _fc;<br />
int n;<br />
if (fc->resp_pos == fc->resp_len) {<br />
fc->resp_len = fc->resp_len fc->resp_len resp_len > MAX_RESP_SIZE) {<br />
fprintf (stderr, "%s: response too large\n", fc->host);<br />
fcon_free (fc);<br />
return;<br />
}<br />
fc->resp = xrealloc (fc->resp, fc->resp_len);<br />
}<br />
n = read (fc->fd, fc->resp + fc->resp_pos, fc->resp_len - fc->resp_pos);<br />
if (n == 0)<br />
finger_done (fc);<br />
else if (n < 0) {<br />
if (errno == EAGAIN)<br />
return;<br />
else<br />
perror (fc->host);<br />
fcon_free (fc);<br />
return;<br />
}<br />
}<br />
fc->resp_pos += n;<br />
static void<br />
finger_senduser (void *_fc)<br />
{<br />
struct fcon *fc = _fc;<br />
int n;<br />
23