From nobody Wed Jun 11 17:44:30 2025 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with UTF8SMTP id 4bHY2K3Yk9z5yDSk for ; Wed, 11 Jun 2025 17:44:41 +0000 (UTC) (envelope-from paul@redbarn.org) Received: from util.redbarn.org (util.redbarn.org [24.104.150.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.redbarn.org", Issuer "RapidSSL TLS RSA CA G1" (verified OK)) by mx1.freebsd.org (Postfix) with UTF8SMTPS id 4bHY2J2rkBz3jwr for ; Wed, 11 Jun 2025 17:44:40 +0000 (UTC) (envelope-from paul@redbarn.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=redbarn.org header.s=util header.b=V5yvaAzL; spf=pass (mx1.freebsd.org: domain of paul@redbarn.org designates 24.104.150.222 as permitted sender) smtp.mailfrom=paul@redbarn.org; dmarc=pass (policy=reject) header.from=redbarn.org Received: from family.redbarn.org (family.redbarn.org [IPv6:2001:559:8000:cd::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.redbarn.org", Issuer "RapidSSL TLS RSA CA G1" (not verified)) by util.redbarn.org (Postfix) with UTF8SMTPS id D53DD160B98 for ; Wed, 11 Jun 2025 17:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=redbarn.org; s=util; t=1749663871; bh=5eLT143lq+TOUi6jPJ/I451zpHJLw+Ls7enqLpnGZCQ=; h=Date:From:To:In-Reply-To:References:Subject; b=V5yvaAzLeGxKCrJmK1LeGzaDBj0TeFe8gLXaPQb+hH2r02Qx/oknFidfPwVBFMIoS XnjUy4UExjp5YZthW/2M2vsX4AnDYsy8llvZb9rLFk8/uumCMTYXB6/JsayoTjZExT u/dN+ZERQHf3uG0NLaILoEZkVohKImWt5ZApiyag= Received: from dummy.faircode.eu (unknown [192.252.249.237]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by family.redbarn.org (Postfix) with UTF8SMTPSA id 9A2FF9 for ; Wed, 11 Jun 2025 17:44:31 +0000 (UTC) Date: Wed, 11 Jun 2025 11:44:30 -0600 (MDT) From: Paul Vixie To: freebsd-net@freebsd.org Message-ID: <0036fcd2-9e13-4717-bf78-97f075a343cf@redbarn.org> In-Reply-To: <1106147709.26643.1749641962654@nm22.abv.bg> References: <1106147709.26643.1749641962654@nm22.abv.bg> Subject: poll / select List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_30_217152210.1749663871059" X-Correlation-ID: <0036fcd2-9e13-4717-bf78-97f075a343cf@redbarn.org> X-Spamd-Result: default: False [-4.93 / 15.00]; DWL_DNSWL_LOW(-1.00)[redbarn.org:dkim]; NEURAL_HAM_MEDIUM(-0.99)[-0.987]; NEURAL_HAM_SHORT(-0.98)[-0.981]; NEURAL_HAM_LONG(-0.96)[-0.958]; DMARC_POLICY_ALLOW(-0.50)[redbarn.org,reject]; R_DKIM_ALLOW(-0.20)[redbarn.org:s=util]; R_SPF_ALLOW(-0.20)[+ip4:24.104.150.0/24]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; FREEFALL_USER(0.00)[paul]; MISSING_XM_UA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:33651, ipnet:24.104.150.0/24, country:US]; MLMMJ_DEST(0.00)[freebsd-net@freebsd.org]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[redbarn.org:+] X-Rspamd-Queue-Id: 4bHY2J2rkBz3jwr X-Spamd-Bar: ---- ------=_Part_30_217152210.1749663871059 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit If you have to answer UDP requests and may need to do separate upstream work to construct that answer, use a nonblocking socket and epoll(), or fork a thread and use a normal blocking socket. This is how DNS servers operate. If you only listen, no answers or other work to do per request other than perhaps logging the inbound messages to the file system, a normal blocking socket is all you need. Paul Vixie ------=_Part_30_217152210.1749663871059 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit If you have to answer UDP requests and may need to do separate upstream work to construct that answer, use a nonblocking socket and epoll(), or fork a thread and use a normal blocking socket. This is how DNS servers operate.

If you only listen, no answers or other work to do per request other than perhaps logging the inbound messages to the file system, a normal blocking socket is all you need.
Paul Vixie
------=_Part_30_217152210.1749663871059--