[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: READ_TIMEOUT problem
From: |
Andrew J. Schorr |
Subject: |
Re: READ_TIMEOUT problem |
Date: |
Thu, 16 Apr 2020 14:55:31 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Thu, Apr 16, 2020 at 08:43:38PM +0300, Andres MERE wrote:
> Halloo,I am trying to set up a (server) process listening incoming
> connections (and doing something useful). Simple experiment like
> gawk 'BEGIN { n = "/inet/tcp/8888/0/0"; PROCINFO[n,
> "READ_TIMEOUT"] = 1000; if ((n |& getline) > 0) { print } }'leads to a
> blocking read. Can anyone explain the reasons for this? Am I
> misunderstanding something?Best regards,Andres
It is actually hanging in the accept call, not while attempting to read.
You can see this by using telnet to connect to that port. It will
timeout 1 second after you connect to the port. So it technically
works as expected. What are you trying to accomplish? The TCP
api in gawk is far from ideal. The gawkextlib select library gives
you some multiplexing features and the ability to configure
non-blocking I/O, but somebody needs to right a sockets library to
work well with that framework. Volunteers are welcome! :-)
Regards,
Andy