From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: HaiJun Zhang Newsgroups: gmane.emacs.devel Subject: Re: Is it possible to change the recv buffer size dynamically for network process or subprocess? Date: Tue, 24 Mar 2020 12:33:11 +0800 Message-ID: References: <1de1c276-1bda-4ada-b3f4-7adaee296628@Spark> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="5e798d8c_77485850_6dce" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="113379"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Robert Pluim Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 24 05:34:08 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jGbGS-000TB5-2h for ged-emacs-devel@m.gmane-mx.org; Tue, 24 Mar 2020 05:34:08 +0100 Original-Received: from localhost ([::1]:42620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGbGR-0003Q0-4U for ged-emacs-devel@m.gmane-mx.org; Tue, 24 Mar 2020 00:34:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59673) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGbFm-0002zY-M7 for emacs-devel@gnu.org; Tue, 24 Mar 2020 00:33:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGbFl-00026y-Ew for emacs-devel@gnu.org; Tue, 24 Mar 2020 00:33:26 -0400 Original-Received: from mail-oln040092254096.outbound.protection.outlook.com ([40.92.254.96]:6019 helo=APC01-PU1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jGbFk-00026E-QG for emacs-devel@gnu.org; Tue, 24 Mar 2020 00:33:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DaCH6t/sl/+9srksbo8eEDJjG8v3CFa0wv/HxkaGoYFKpJg0egAflZpcEr5GBsdTXHSpYp4nWzh2SyyMlCNwCz4BpxQGCBZRellKRgETfIfto5qAdttwCIE4gteuegZFWYNUHwLy/dnGsGNi1AvhLvSdjFA7i52oNbXLYXIV7mHMpAPEHB5/RBV/fD2IZAPQdAyFM/lmOGRtlGM6AYguDr5NnRZ32B2E5ZRSaDxDZbM46RYJgN/qSIyAd2KAgQwjZSwAj8r+ox6fUWTxI7+4UMynT59IdNZ0QO0HrtCDvOOrwRAYT2Prb5w4fEh/SSZuBZx1Ts87qzAeCZkbVolLUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z9aCh6dR5WtyJ0jlhstxccy/BmWl4vcnTefJtovQrJo=; b=QU3/JyVqHYTC9IMn919i23hsqQHULK9rvMZjobH14OARnW+yPR6oj7kwZSrkMvtjoJZPGx3gEchHoH61nSxXWY0M0FNiQ4MHHTAAVYBGtITxcIpr4Wjwwb+41kWW17awYft/o1Ffm3XDbH6CgW4ITCLcQaz+e8aeErHgVFqFBMaAQrSRpdyrdoMhB2vJ9e8ey2jOmfcvmrLgEH+e8BfxUs23DwwbLL98+vkICpxA4/xDhSWUalyblQpW6bzcTH0/VXMSXvDQmCD/MLHoYj02LyFSX6A0y2lkyxM7+IQ5YSjA2HwMKXMQFTzOYpYJZxVJ9g0BRwgU8lofhiMKVGRx6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=outlook.com; dmarc=pass action=none header.from=outlook.com; dkim=pass header.d=outlook.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z9aCh6dR5WtyJ0jlhstxccy/BmWl4vcnTefJtovQrJo=; b=XkdaAFwvOfdvi3EL6hXM9FPAcrE+NdmqRNJ6geu9xs4HwUetK/3lpK0twxfmq3sAjH2RpZx2yCFapSD1tSCQJERQ2mCbFrYuDaEJkmnvhIro4FdBtmYSFwUqBbHimJIIk+oEUw6ifzqgmhyxJlAJsfc8zAvQTf0FpxsWO56hIULx0QO4ydFeQ6sErMQxPyGbjfpLny+EjIS8K0vim7pWSq4lWifc8Nu5+Hh5/T/t0xUBlUY1iIocTZSCDIAy6Q1ep99CL8Ubwvi25G8AM3FwaSxOdMa8npGkB4riXhGtqVSYOd9hVzwBFZkC6KweGz7BE4PH/wGG/KpmTSjSIrXAJA== Original-Received: from HK2APC01FT050.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::36) by HK2APC01HT144.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::294) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.13; Tue, 24 Mar 2020 04:33:21 +0000 Original-Received: from PS1PR03MB3606.apcprd03.prod.outlook.com (10.152.248.53) by HK2APC01FT050.mail.protection.outlook.com (10.152.249.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.13 via Frontend Transport; Tue, 24 Mar 2020 04:33:20 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:28969F148B94A5C5EA98869FAF6243C610D8BF9C1144B06D394DD18CEADF0D47; UpperCasedChecksum:5EF0CD5ED89730FA9CFCC802B0894900DD396BC71A4F3F4FC92214FACF489319; SizeAsReceived:9002; Count:49 Original-Received: from PS1PR03MB3606.apcprd03.prod.outlook.com ([fe80::85cb:c430:1173:7716]) by PS1PR03MB3606.apcprd03.prod.outlook.com ([fe80::85cb:c430:1173:7716%5]) with mapi id 15.20.2835.021; Tue, 24 Mar 2020 04:33:20 +0000 In-Reply-To: X-Readdle-Message-ID: 3b6044ea-9aec-4887-b618-655acadb462c@Spark X-ClientProxiedBy: HK0PR01CA0058.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::22) To PS1PR03MB3606.apcprd03.prod.outlook.com (2603:1096:803:4e::17) X-Microsoft-Original-Message-ID: <3b6044ea-9aec-4887-b618-655acadb462c@Spark> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from [192.168.1.150] (1.196.184.53) by HK0PR01CA0058.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.15 via Frontend Transport; Tue, 24 Mar 2020 04:33:19 +0000 X-Readdle-Message-ID: 3b6044ea-9aec-4887-b618-655acadb462c@Spark X-Microsoft-Original-Message-ID: <3b6044ea-9aec-4887-b618-655acadb462c@Spark> X-TMN: [qGuzPy3zVK5Ce9X87gKuUFVU5WRhxb/o] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 49 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 0d01b9df-45c1-4900-6db7-08d7cfac7b08 X-MS-TrafficTypeDiagnostic: HK2APC01HT144: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cpHUfIClwjqwpPekJgpa/EuEYduMNX/l/ucjTOO3qBfeoWjWoCTUghZfCV+gI55oRVu9ZJYw5lxpXUK/tSUevwdfpm/pEbzU8QWDUbr0iCTHw84uwFjb0GcFxgMsr9DI1AjADzAPh7qUURWgYCF/dhSeO2BgwOZhJQhW5Z/VqXzZckol+qPybVNuTKM8TBga X-MS-Exchange-AntiSpam-MessageData: JLcvAp6mIjHCf+zcvWxsSU4JbMPG0lpZ51XLIhYr9G8LboS6k+xWS8Zx6Mw85Qof71navIMd2j35GUO10pO+VBcLa97FtLRQYIA8BwGLXZwPki1hqqVLMMPJ62d/68bYuF7rx6TwlJcz9GdRNkYEtA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d01b9df-45c1-4900-6db7-08d7cfac7b08 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2020 04:33:20.7275 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT144 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.92.254.96 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:245750 Archived-At: --5e798d8c_77485850_6dce Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline =E5=9C=A8 2020=E5=B9=B43=E6=9C=8822=E6=97=A5 +0800 PM11:12=EF=BC=8CRobert= Pluim =EF=BC=8C=E5=86=99=E9=81=93=EF=BC=9A > > > > > > On Sun, 22 Mar 2020 09:26:37 +0800, HaiJun Zhang said: > > HaiJun> I want to do flow control, because too many data may cause UI > HaiJun> unresponsive. Set the recv buffer size to 4, and if I don=E2=80= =99t fetch the > HaiJun> four bytes, please don=E2=80=99t receive more data. If the size= (In the four > HaiJun> bytes header) is too big, ask the user if the message should be= > HaiJun> received. > > I don=CA=BCt see how this is any different from just doing recv, checki= ng > the 4 bytes, and then asking the user. In any case, if the remote end > has sent you the message, it will be in the local kernel buffers > anyway, so you=E2=80=99ll have to read it at some point anyway. > With flow control, we can block the sender(for tcp or subprocess) for som= etime to keep good responsiveness. --5e798d8c_77485850_6dce Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
=E5=9C=A8 2020=E5=B9=B43=E6=9C=8822=E6=97= =A5 +0800 PM11:12=EF=BC=8CRobert Pluim <rpluim@gmail.com>=EF=BC= =8C=E5=86=99=E9=81=93=EF=BC=9A
On Sun, 22 Mar 2020 09= :26:37 +0800, HaiJun Zhang <netjune@outlook.com> said:

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

I don=CA=BCt see how this is any different from just doing recv, checking the 4 bytes, and then asking the user. In any case, if the remote end
has sent you the message, it will be in the local kernel buffers
anyway, so you=E2=80=99ll have to read it at some point anyway.

With flow control, we can block the sender(for tcp or subprocess) for somet= ime to keep good responsiveness.

--5e798d8c_77485850_6dce--