Groups | Search | Server Info | Login | Register


Groups > comp.lang.awk > #167

Re: getline timeout (revisited)

Newsgroups comp.lang.awk
From j.eh@mchsi.com
Subject Re: getline timeout (revisited)
References <inmun6$lq1$1@speranza.aioe.org>
Message-ID <CsqdnTvy49IoCjDQnZ2dnUVZ_t2dnZ2d@mchsi.com> (permalink)
Date 2011-04-19 09:09 -0500

Show all headers | View raw


In article <inmun6$lq1$1@speranza.aioe.org>, Janis Papanagnou wrote:
> I've been currently looking for a timeout option for getline in
> the context of an /inet/tcp/... socket communication with gawk.
> 
> This topic had already been addressed here in c.l.a many many
> years ago, as my google search showed, but I haven't found any
> positive answers. Has there been something incorporated in gawk
> or xgawk, meanwhile, or is the status unchanged. I suppose the
> latter, but asking for a confirmation anyway.

[ Janis, I hit the wrong button. My intention was to post to
the group, not to send a personal email. Sorry about that. ]


I find the discussions in the old threads interesting, but I have
a question. Let's assume we use PROCINFO to specify timeout like
this:

     PROCINFO["/inet/tcp/..", "TIMEOUT"] = 1000 (ms)

and a value of 0 means the default behavior i.e. no timeout.

Also, assume the existence of a builtin either in the gawk source
or in a extension:

     readline("/inet/tcp/..")

which other than being a function call behaves exactly like getline
w.r.t. RS, RT and setting fields. We modify 'readline' to handle
timeout anyway you think is suitable to serve our purpose. The question
is then, if a script using 'readline' going to look any different
than from the one that uses getline with exactly the same
modifications. If possible, please consider providing the outline
of such a script illustrating the usage of 'readline' or getline
with timeout. To keep things uniform, assume we parse ERRNO to
find out the cause of error. Not very gifted when it comes to writing
awk scripts that doesn't look like C, so I hope you understand my
request in this context. 

Thanks,

John

> 
> Thanks.
> 
> Janis

Back to comp.lang.awk | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

getline timeout (revisited) Janis Papanagnou <janis_papanagnou@hotmail.com> - 2011-04-08 14:23 +0200
  Re: getline timeout (revisited) arnold@skeeve.com (Aharon Robbins) - 2011-04-10 18:49 +0000
  Re: getline timeout (revisited) j.eh@mchsi.com - 2011-04-19 09:09 -0500
    Re: getline timeout (revisited) Janis Papanagnou <janis_papanagnou@hotmail.com> - 2011-04-19 17:38 +0200
      Re: getline timeout (revisited) j.eh@mchsi.com - 2011-04-20 06:51 -0500
        Re: getline timeout (revisited) Janis Papanagnou <janis_papanagnou@hotmail.com> - 2011-04-20 14:20 +0200
          Re: getline timeout (revisited) j.eh@mchsi.com - 2011-04-20 08:21 -0500
            Re: getline timeout (revisited) j.eh@mchsi.com - 2011-04-21 05:46 -0500
            Re: getline timeout (revisited) arnold@skeeve.com (Aharon Robbins) - 2011-04-22 13:55 +0000
              Re: getline timeout (revisited) Grant <omg@grrr.id.au> - 2011-04-23 06:50 +1000

csiph-web