|
From: | Basile Starynkevitch |
Subject: | Re: How to abort a read from a socket after some time? |
Date: | Sun, 21 Jan 2024 19:57:06 +0100 |
User-agent: | Mozilla Thunderbird |
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 seehttps://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 <basile@starynkevitch.net> (only mine opinions / les opinions sont miennes uniquement) 92340 Bourg-la-Reine, France web page: starynkevitch.net/Basile/ See https://github.com/RefPerSys/RefPerSys
[Prev in Thread] | Current Thread | [Next in Thread] |