From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Basile Starynkevitch Newsgroups: gmane.lisp.guile.user Subject: Re: How to abort a read from a socket after some time? Date: Sun, 21 Jan 2024 19:57:06 +0100 Message-ID: <582a8386-75cb-497d-b886-39b92d05bbcf@starynkevitch.net> References: <87mssy8rih.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25177"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Jan 21 19:57:47 2024 Return-path: Envelope-to: guile-user@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 1rRd0t-0006Mc-4F for guile-user@m.gmane-mx.org; Sun, 21 Jan 2024 19:57:47 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRd0O-0002cK-8U; Sun, 21 Jan 2024 13:57:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rRd0M-0002bt-63 for guile-user@gnu.org; Sun, 21 Jan 2024 13:57:14 -0500 Original-Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rRd0J-0002X8-PP for guile-user@gnu.org; Sun, 21 Jan 2024 13:57:13 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id B3CB21C0003 for ; Sun, 21 Jan 2024 18:57:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=starynkevitch.net; s=gm1; t=1705863426; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HNbu20oXmBeK69C0zcKwHxBUcYPQGjsO7UqR5/qRkco=; b=jn6dqx67Ye2UseeXjQ5T81fGhHQvSaBpPTipq3sRnfjU2YuFX3s2WsusSShhCkzuHwKfHO NRiH8iekakx5dmHvZX+HEgr2VC+eCB84dyK1oeEnHFI8V0MOTNnryIi+nyp3exoamO/FNP 5jL+7IUYQVjdcTQCo0vzzblgijanFqCAkZrTeBc9QJEFAjI2ex5XRnn/vn80LUUbfiCHVp WQG7c8vY503pL8IuoUjFwVITOZG3Rv+aMoGg5bHkEpyeEdjdcnhWvr875t0KrsuSYAOLRL BVR57E7soe5Mdkq5tkwCr7yPu4OASqyk/5Cr/4RnzmJUTtOyAqRLxRylU6Jxlg== Content-Language: en-US In-Reply-To: <87mssy8rih.fsf@gmail.com> X-GND-Sasl: basile@starynkevitch.net Received-SPF: pass client-ip=2001:4b98:dc4:8::225; envelope-from=basile@starynkevitch.net; helo=relay5-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19411 Archived-At: On 1/21/24 19:34, Maxim Cournoyer wrote: > Hi Tomas, > > Tomas Volf <~@wolfsden.cz> writes: > >> Hello, >> >> I am trying to figure out how to abort a read from a socket after some time >> elapses. I failed to figure out how to do so. > > If the reason you want to abort reading from a socket is because the > socket may not be ready, you could use select(2), which has a timeout > value. > > See man 2 select or the corresponding 'select' procedure documented in > the Guile Reference manual. > The poll(2) system call (for details see https://man7.org/linux/man-pages/man2/poll.2.html ....) could be preferred, and has a simpler timeout (milliseconds). It also can deal with more (or few, but numerically bigger) file descriptors than select. So I suggest using poll, not select. Regards -- Basile Starynkevitch (only mine opinions / les opinions sont miennes uniquement) 92340 Bourg-la-Reine, France web page: starynkevitch.net/Basile/ See https://github.com/RefPerSys/RefPerSys