bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Issue with read timeout on TCP socket


From: Davide Brini
Subject: Re: [bug-gawk] Issue with read timeout on TCP socket
Date: Thu, 30 May 2013 10:45:14 +0200

On Thu, 30 May 2013 02:21:29 +0300, "Serge A. Zaitsev"
<address@hidden> wrote:

> Hi, guys!
> 
> I'm using Gawk 4.1.0, and it seems like it's working not as expected with
> TCP sockets.
> Here's my sample script:
> 
> BEGIN {
> server = "/inet4/tcp/0/127.0.0.1/12345"
> PROCINFO[server, "READ_TIMEOUT"] = 1000
> for (i = 0; i < 10; i++) {
> if ((server |& getline) > 0) {
> print(">>", $0);
> } else {
> print(ERRNO);
> }
> }
> }
> 
> It should be simple - I connect to localhost:12345, then read with timeout
> for 10 times.
> What I expect to see is: 10 times a 1sec timeout if no data available,
> with corresponding ERRNO.

That depends on whether there is something listening on port 12345, and if
so, on how it behaves.

If there's nothing listening, you'll just get RST on connection attempt and
will see 10 error messages in rapid sequence, without any timeout (since
the TCP connection isn't even established). At least under Linux, but I'd
be surprised if this was different under other operating systems.


-- 
D.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]