+ ssize_t count;
+ struct pollfd fds = {inSocket, POLLIN, 0}; /* poll for data ready on the socket */
+ int poll_rc = 0;
+
+ poll_rc = poll(&fds, 1, READBUFFER_TIMEOUT);
+ if (poll_rc == 0) {
+ /* timed out */
+ err = ETIMEDOUT;
+ continue;
+ } else if (poll_rc < 0) {
+ /* try again if we were interrupted, otherwise exit */
+ if (errno != EINTR) {
+ err = errno;
+ }
+ continue;
+ }
+
+ /* Data should be ready to read */
+ count = read (inSocket, ptr, inBufferLength - bytesRead);