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: Is it possible to change the recv buffer size dynamically for network process or subprocess? Date: Sat, 21 Mar 2020 11:01:05 +0800 Message-ID: References: <1de1c276-1bda-4ada-b3f4-7adaee296628@Spark> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="5e758376_4b588f54_6dce" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="74307"; mail-complaints-to="usenet@ciao.gmane.io" To: "Emanuel Berg via Emacs development discussions." Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 21 04:02:24 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 1jFUP2-000JE4-3K for ged-emacs-devel@m.gmane-mx.org; Sat, 21 Mar 2020 04:02:24 +0100 Original-Received: from localhost ([::1]:32924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFUP1-0002YW-2l for ged-emacs-devel@m.gmane-mx.org; Fri, 20 Mar 2020 23:02:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50173) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFUO4-00028M-9D for emacs-devel@gnu.org; Fri, 20 Mar 2020 23:01:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jFUO1-0002Ml-Jd for emacs-devel@gnu.org; Fri, 20 Mar 2020 23:01:22 -0400 Original-Received: from mail-oln040092254109.outbound.protection.outlook.com ([40.92.254.109]:28665 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 1jFUNx-0002Km-Qv for emacs-devel@gnu.org; Fri, 20 Mar 2020 23:01:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e6aDRZjaACoBVO3xFQPxCaWQveuLbkzQcUKBbeNSDa+WhWr5ZmKMYLnJzrdPUY1C6SD1aqaOcihvnm4VxQz3IOnCb3qIkf9R7AybzuNgmSut8409X+QhxM3OPtVA/1N5niyb524TYoUOnvzJ8w4EwOXgA7tt2FJkiyjD2UjsfvcCTReIohE/mZC5cBuY4YrxneiXqZbYLBkzmt4rE1PxTebDr8Nz7aUo025TsEmJfHmpD/zTH37OtiVbYAHqggzpz/ET/njK76qdu0Y1iwg/Gg6XRdcibBU3a7gl6/MRR+MRlpMX6J5LIwlJhumtvixJY1d2z7Rb76a0pLX4I6ALJw== 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=dV2PTpFqNxVR6koJ2syqYj7y3rtmK5fdB91XNAryV+s=; b=XqBMk/c8iX5azvmN9HbmeYGTkZGhk3BSjSk4SsqbRBcDRFx3LyameUWhPK7S8eBS8YlBSNDslhqCNIsX6UxNcN1l1LW0zB3t4IMWa7VKtZh9eZ9Afgo/Z/a2S1qIRqP6pO4FyrMv7WkiZLfKksPqknTH5c1BIa0AQNIdnDDP14UvUfwNxiMPYXrLMVqVL4hUv7KKE8B+hsouFJ4IYAjg7ZKk6STZO+tP/8c4EQPQJHm5ur9PrsnA7/EBOlrnMplHRVWrszTpfpHNhn7EXxo54K91vpGx8WYuWxSP1a5VsEHjF8deOrBXmNr5MR9zosoTjGVrZe4svPhWvWZbC7PfvQ== 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=dV2PTpFqNxVR6koJ2syqYj7y3rtmK5fdB91XNAryV+s=; b=gkJn2/WMLv4aajZpqyB+b6F8m/75F9PIq9UuVUAYwoJvF5pT/uQfsArzaexm/ccV75y2WMpLrZYbmlPH7AbRAlvQ534l0mskukNH3J37VlOt84dAD9/YWHeIKcwIV2QjT/677ryL2RGeMXeAVOHn/1mET8RU85V19sWZJG6D2+GtSjgMMmDKtY451XhsTYoMfZ78gvngYSjtDS4EEcFXohbIPYKIwEPpWrUB69pFziASs3AbjVl2fybj1vl1zBQCjtyz+DN8H+FSVOPWycx4vE7HugQaabuOXcOMMiItIvfs/lsLefVX9chHfHZER99cEDNjEkbywvynjn0iBd7n2w== Original-Received: from HK2APC01FT011.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::35) by HK2APC01HT221.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::444) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.13; Sat, 21 Mar 2020 03:01:13 +0000 Original-Received: from PS1PR03MB3606.apcprd03.prod.outlook.com (10.152.248.53) by HK2APC01FT011.mail.protection.outlook.com (10.152.248.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.13 via Frontend Transport; Sat, 21 Mar 2020 03:01:13 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:11FCA7C5920D3C49C41D20CEDDCB0DF739649AD6897075DFBB57B6C7DCB73565; UpperCasedChecksum:7F6A3B7C1D8C5D9EBD096117BD604F6E76AF043DED6526C1BDD69E9770786671; SizeAsReceived:8750; Count:47 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.017; Sat, 21 Mar 2020 03:01:13 +0000 X-Readdle-Message-ID: c6fb7a70-7e9d-4f4f-874d-9268254781e6@Spark X-ClientProxiedBy: HK0PR01CA0061.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::25) To PS1PR03MB3606.apcprd03.prod.outlook.com (2603:1096:803:4e::17) X-Microsoft-Original-Message-ID: X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from [192.168.1.150] (1.193.171.233) by HK0PR01CA0061.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.19 via Frontend Transport; Sat, 21 Mar 2020 03:01:13 +0000 X-Readdle-Message-ID: c6fb7a70-7e9d-4f4f-874d-9268254781e6@Spark X-Microsoft-Original-Message-ID: X-TMN: [+b5u24xlGBJNjVr9lcXO6i1+4cOe1g/F] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 6eb6acfa-edb7-4d6c-dac4-08d7cd441da0 X-MS-TrafficTypeDiagnostic: HK2APC01HT221: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5fZXznZooQWHdA3rAZWjwIYZiVOUw0gjOe3OVCbrWYKKK2Nk1h+g/dZs7XQjZ2WXTGvhr/2Mn4Thdgeh+xorAKWkZxJOQyXCSA0cclVukLYpt8eid2xjYxloy5uBy3rWgrfVgH2b7gz6angBWFdoqyFVXmflaEeJ6BPaFVGmXoUev9d0mEr2zU/PexPKpdlj X-MS-Exchange-AntiSpam-MessageData: omfDtPFQsqneq0BghY5CkW7BHfLJ0qJXzUDN/qzViBff/Xb5awzIviFBYTwHn0NVPYiLTlGSyhejZ6R0j+T8GtWkoTxpXoECtb4HPh8+eHlhwaApp88LvkO7RVOzz8XkJACYADf9y9LnWU6m+iLmfQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6eb6acfa-edb7-4d6c-dac4-08d7cd441da0 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2020 03:01:13.7604 (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: HK2APC01HT221 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.92.254.109 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:245620 Archived-At: --5e758376_4b588f54_6dce Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline For example, I have binary message format like this: 1. It has a four-bytes header and payload. 2. The four-bytes header is the payload size of the message. First I want to set the size of the recv buffer to 4. After the four bytes arrived, I parse them and get the size of the payload. Then I set the size of the recv buffer to the size of the payload to recv the payload. --5e758376_4b588f54_6dce Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
For example, I have binary message format like this:
  1. It has a four-bytes header and payload.
  2. The four-bytes header is the payload size of the message.
First I want to set the size of the recv buffer to 4. Aft= er the four bytes arrived, I parse them and get the size of the payload. Th= en I set the size of the recv buffer to the size of the payload to recv the= payload.


--5e758376_4b588f54_6dce--