From owner-freebsd-questions@freebsd.org Tue Jun 26 15:13:51 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5ECB2102AABC for ; Tue, 26 Jun 2018 15:13:50 +0000 (UTC) (envelope-from kelly@rsw-power.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 3739674B88 for ; Tue, 26 Jun 2018 15:13:49 +0000 (UTC) (envelope-from kelly@rsw-power.com) Received: by mailman.ysv.freebsd.org (Postfix) id E6189102AABA; Tue, 26 Jun 2018 15:13:48 +0000 (UTC) Delivered-To: questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AEF5102AAB8 for ; Tue, 26 Jun 2018 15:13:48 +0000 (UTC) (envelope-from kelly@rsw-power.com) Received: from m97106.mail.qiye.163.com (m97106.mail.qiye.163.com [220.181.97.106]) by mx1.freebsd.org (Postfix) with ESMTP id 5FA5874B84 for ; Tue, 26 Jun 2018 15:13:44 +0000 (UTC) (envelope-from kelly@rsw-power.com) Received: from localhost (unknown [127.0.0.1]) by wmsvr3 (Coremail) with SMTP id TSWEB_000000070000730B5B325075; Tue, 26 Jun 2018 22:40:53 +0800 (CST) Received: from kelly$rsw-power.com ( [119.123.74.132] ) by ajax-webmail-wmsvr12 (Coremail) ; Mon, 25 Jun 2018 17:09:05 +0800 (CST) X-Originating-IP: [119.123.74.132] Date: Tue, 26 Jun 2018 22:40:00 +0800 (CST) From: kelly To: questions@freebsd.org Subject: Re: Handheld Inkjet Printer Manufacturer X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20150911(74783.7961) Copyright (c) 2002-2018 www.mailtech.cn 163-hosting MIME-Version: 1.0 Message-ID: <123b8573.12e8c.16436342a0b.Coremail.kelly@rsw-power.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: auCowADX5JZ9UDJbMYUgAA--.3W X-CM-SenderInfo: xnhoz546uv4gpsrzv2oofrz/1tbifR1wElrpMw+8fAABsM X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== Content-Type: text/plain; charset=GBK Content-Transfer-Encoding: base64 X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2018 15:13:51 -0000 RGVhciBNYW5hZ2VyLAoKCkdvb2QgZGF5IQoKCldlIGluZGVwZW5kZW50bHkgZGV2ZWxvcGVkIGEg aGFuZGhlbGQgaW5ramV0IHByaW50ZXIgd2l0aCBnb29kIHF1YWxpdHksIHdoaWNoIGlzIHdpZGVs eSB1c2VkIGFuZCBwb3B1bGFyIHRocm91Z2hvdXQgZGlmZmVyZW50IGNvdW50cmllcy4gSG9wZSB0 aGUgYmVsb3cgcHJvZHVjdCBjYW4gaGVscCB5b3Ugc2F2ZSB0aGUgY29zdHMuCgoKRm9sbG93aW5n IGlzIG9uZSBvZiBvdXIgbW9kZWw6Ckl0ZW06IEhhbmRoZWxkIElua2pldCBQcmludGVyIHdpdGgg U29sdmVudCBJbmsgKFF1aWNrIERyeSkKLSBXaXRoIDMuNSBpbmNoIHRvdWNoYWJsZSBzY3JlZW4g dGhhdCB5b3UgY2FuIGVkaXQgdGhlIGNvbnRlbnRzIGRpcmVjdGx5IHZpYSBzY3JlZW4gb3IgaW1w b3J0ZWQgdGhlIGNvbnRlbnRzIGZyb20gVS1kaXNrLgotIFBvcnRhYmxlLCBzaW1wbGUgaW50ZXJm YWNlIGFuZCBlYXN5IHRvIG9wZXJhdGUuCi0gSXQ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un 26 16:46:00 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEDF11002437 for ; Tue, 26 Jun 2018 16:46:00 +0000 (UTC) (envelope-from mailinglist@diamondbox.dk) Received: from mailrelay4-3.pub.mailoutpod1-cph3.one.com (mailrelay4-3.pub.mailoutpod1-cph3.one.com [46.30.212.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F44E78F09 for ; Tue, 26 Jun 2018 16:45:59 +0000 (UTC) (envelope-from mailinglist@diamondbox.dk) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=diamondbox.dk; s=20140924; h=from:subject:date:message-id:to:mime-version:content-type: content-transfer-encoding; bh=692vTTGx/mzLOaNCdrYqEhJNL7MdE8lzOVi/lHritZo=; b=ONiWfiO8VLOMxSR771sxvdijuZGCIZivSDy06Lq+Txf7XwbMACa5FjH5Ciyr2pQzswo2EQYMyFttS vfBHDfG/iavLwd/GOWRmUK6q3A8yg+z/XMAqQNPqUvPBc6YAkJXTzqQLzr+6vQuf53EO9n3mCdwajE Lp+fw8KfuK4vOkcs= X-HalOne-Cookie: 0b39522271104356e613ea325c1887099ba4f046 X-HalOne-ID: 24421df6-795e-11e8-a331-d0431ea8bb10 Received: from diamond.diamondbox.dk (unknown [212.237.134.61]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 24421df6-795e-11e8-a331-d0431ea8bb10; Tue, 26 Jun 2018 16:29:47 +0000 (UTC) To: FreeBSD Questions From: Nikolaj Thygesen Subject: Small buffers for recv() Organization: diamondbox.dk Message-ID: Date: Tue, 26 Jun 2018 18:29:49 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: da X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2018 16:46:00 -0000 Hi,     I'm currently writing an application which passes data between sub-programs through non-blocking sockets. Today I experimented (for testing purposes) with using buffers of different sizes for recv(). When I do:     recv(fd, reinterpret_cast(buffer), size_of_buffer, 0); ... with *size_of_buffer* being e.g. 100 I get loads of EAGAIN's, but if I use e.g. 5000 everything works fine. I do understand why performance suffers, but the many EAGAIN's puzzle me a bit - what is the problem? Is there some way of detecting the optimal size to use? Google didn't bring me any closer to an answer.     br - Nikolaj FreeBSD fb.diamondbox.dk 11.1-RELEASE FreeBSD 11.1-RELEASE #3 r321520: Wed Jul 26 20:21:21 CEST 2017 user:/usr/obj/usr/src/sys/DIAMOND  amd64