From: michi1@michaelblizek.twilightparadox.com (michi1 at michaelblizek.twilightparadox.com)
To: kernelnewbies@lists.kernelnewbies.org
Subject: What causes a recv syscall for a socket to sometimes return less than the request len?
Date: Fri, 23 Sep 2016 18:04:48 +0200 [thread overview]
Message-ID: <20160923160448.GA3415@grml> (raw)
In-Reply-To: <CAJGew6nV3wQ+d_cJEjTpQw33+x9Kx7vQc2vPEiXJ2e4ajsECAw@mail.gmail.com>
Hi!
On 17:20 Wed 21 Sep , Daniel Ellis wrote:
> Howdy,
>
> I understand that data fragmentation happens across TCP packets, and in my
> case that is what is happening. The packets I'm seeing usually run around
> 1450 in length, and are always cut into two packets at the 1400 mark. This
> works fine most of the time, since the call to recv is being passed a len
> of 4096 (via Python's socket.recv, which I'm assuming is just a wrapper
> around the system call). But sometimes I'll get all of the data I request,
> even across TCP packet boundaries (so the full 1450 bytes), and other
> times, it stops at a single packet, at which point I need to make another
> recv call.
The recv() call currently returns:
- as soon as there is some data in the receive queue
- all the data which is in the queue, up your buffer size.
-Michi
--
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com
prev parent reply other threads:[~2016-09-23 16:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-22 0:20 What causes a recv syscall for a socket to sometimes return less than the request len? Daniel Ellis
2016-09-22 0:56 ` Andrey Utkin
2016-09-23 16:04 ` michi1 at michaelblizek.twilightparadox.com [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160923160448.GA3415@grml \
--to=michi1@michaelblizek.twilightparadox.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.