Resuming a partially submitted buffer

A client must submit a 9216-byte buffer to a connected nonblocking TCP socket. Its send loop starts with a zero-based byte offset of zero. Each call requests the entire unsent suffix, and the loop advances its offset only by a positive return value.


The first three calls have these outcomes:

  • The first send returns 2048.
  • The second send returns -1 with errno set to EAGAIN; it accepts no bytes.
  • After waiting for another opportunity to send, the third send returns 1536.

Find the byte offset of the first unsent byte and the number of bytes still unsent after these calls. For subsequent calls, the application caps each requested length at 1024 bytes. Find the minimum number of additional successful send calls needed to submit the remaining bytes. Assume no other errors or data submissions. Give all three answers as exact integers.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Socket Communication Questions: