"Talking" With The Server After we got the socket connected, we may use the socket just like a regular file descriptor, with system calls such as 'read' and 'write'. #include /* defines 'read', 'write, etc. */ #define BUFLEN 1024 char buf[BUFLEN]; /* reading buffer. */ char* pc = buf; /* now that we are connected, start reading from the */ /* socket till read() returns 0, meaning the server */ /* closed the connection. */ while (rc = read(s, pc, BUFLEN - (pc-buf))) { pc += rc; } /* close the connection on our side. */ close(s);