unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: HaiJun Zhang <netjune@outlook.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Is it possible to change the recv buffer size dynamically for network process or subprocess?
Date: Sun, 22 Mar 2020 09:26:37 +0800	[thread overview]
Message-ID: <PS1PR03MB360610B9A1D91B48D2D2BB17B7F30@PS1PR03MB3606.apcprd03.prod.outlook.com> (raw)
In-Reply-To: <m2eetl9adr.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1058 bytes --]

在 2020年3月21日 +0800 PM8:10,Robert Pluim <rpluim@gmail.com>,写道:
> > > > > > On Sat, 21 Mar 2020 11:01:05 +0800, HaiJun Zhang <netjune@outlook.com> said:
>
> HaiJun> For example, I have binary message format like this:
> HaiJun> 1. It has a four-bytes header and payload.
> HaiJun> 2. The four-bytes header is the payload size of the message.
>
> HaiJun> First I want to set the size of the recv buffer to 4. After the four
> HaiJun> bytes arrived, I parse them and get the size of the payload. Then I
> HaiJun> set the size of the recv buffer to the size of the payload to recv the
> HaiJun> payload.
>
> Why bother? Youʼre going to have to handle partial recv for the
> payload anyway, so you might as well do it from the start.
>
> Robert

I want to do flow control, because too many data may cause UI unresponsive. Set the recv buffer size to 4, and if I don’t fetch the four bytes, please don’t receive more data. If the size (In the four bytes header) is too big, ask the user if the message should be received.


[-- Attachment #2: Type: text/html, Size: 2234 bytes --]

  reply	other threads:[~2020-03-22  1:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1de1c276-1bda-4ada-b3f4-7adaee296628@Spark>
2020-03-21  3:01 ` Is it possible to change the recv buffer size dynamically for network process or subprocess? HaiJun Zhang
2020-03-21 12:10   ` Robert Pluim
2020-03-22  1:26     ` HaiJun Zhang [this message]
2020-03-22 15:12       ` Robert Pluim
2020-03-22 17:00         ` Eli Zaretskii
2020-03-24  4:33         ` HaiJun Zhang
2020-03-22 18:13       ` Stefan Monnier
2020-03-24  4:30         ` HaiJun Zhang
2020-03-24 14:01           ` Eli Zaretskii
2020-03-26 13:43             ` HaiJun Zhang
2020-03-26 14:38               ` Eli Zaretskii
2020-03-29  1:44                 ` HaiJun Zhang
2020-03-29  2:38                   ` Eli Zaretskii
2020-04-04 12:17                     ` HaiJun Zhang
2020-04-04 12:55                       ` Eli Zaretskii
2020-04-24 18:43                       ` yyoncho
2020-03-30  3:37                   ` Richard Stallman
2020-03-26 16:14               ` Stefan Monnier
2020-03-26 17:02                 ` Noam Postavsky
2020-03-26 17:34                   ` Stefan Monnier
2020-03-29  1:41                     ` HaiJun Zhang
2020-03-24 14:19           ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PS1PR03MB360610B9A1D91B48D2D2BB17B7F30@PS1PR03MB3606.apcprd03.prod.outlook.com \
    --to=netjune@outlook.com \
    --cc=emacs-devel@gnu.org \
    --cc=rpluim@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).