linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manas Garg <mls@chakpak.net>
To: linux-c-prog <linux-c-programming@vger.kernel.org>
Subject: Re: recv()
Date: Tue, 27 Aug 2002 09:51:58 +0530	[thread overview]
Message-ID: <20020827095158.A1505@chakpak.com> (raw)
In-Reply-To: <LFEIJFMKHCJIHBFOGINPCEIGCHAA.elapus@ntsp.nec.co.jp>

On Tue Aug 27, 2002 at 10:41:01AM -0700, Earl R. Lapus wrote:
>      When calling recv() you specify the maximum data
>      size you want to receive, right? So if the actual data
>      sent at the other end is larger... what happens to the
>      rest of the data? Who manages the data? 

It depends on the type of socket.

In case of TCP, recv() acts on all the data that has been received on
the socket and if it can get all the available data to the user (because
of the size of the buffer supplied to recv()), the remaining data will
be kept in kernel receive buffer for that particular socket.

In case of UDP, recv() acts on the data received in one datagram. If the
kernel can't return all the data of a datagram because of buffer size
constraints, it will discard the rest of the data that came as a part of
that datagram.

All this is clearly mentioned in the man page of recv(2).

/manas
http://www.chakpak.com

       reply	other threads:[~2002-08-27  4:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <LFEIJFMKHCJIHBFOGINPCEIGCHAA.elapus@ntsp.nec.co.jp>
2002-08-27  4:21 ` Manas Garg [this message]
2002-08-27  4:23 ` recv() Glynn Clements

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=20020827095158.A1505@chakpak.com \
    --to=mls@chakpak.net \
    --cc=linux-c-programming@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).