Using TCP Through Sockets
Using TCP Through Sockets
Using TCP Through Sockets
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
}<br />
close (s);<br />
return -1;<br />
}<br />
return s;<br />
/* Read a line of input from a file descriptor and return it. Returns<br />
* NULL on EOF/error/out of memory. May over-read, so don’t use this<br />
* if there is useful data after the first line. */<br />
static char *<br />
readline (int s)<br />
{<br />
char *buf = NULL, *nbuf;<br />
int buf_pos = 0, buf_len = 0;<br />
int i, n;<br />
for (;;) {<br />
/* Ensure there is room in the buffer */<br />
if (buf_pos == buf_len) {<br />
buf_len = buf_len buf_len