bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Gawk: Trap/handle a fatal error on tcp/ip networking


From: Haris Makripodis
Subject: Re: Gawk: Trap/handle a fatal error on tcp/ip networking
Date: Tue, 01 Jan 2008 13:24:41 +0200

Thank you Arnold,

At this time I did my job by issuing the "wget" program through gawk
instead of using its embedded tcp/ip networking support. If you could
find any spare time, I would appreciated if you could send me a patch
for the 3.1.5 version. 

I think that network error and connection-timeout handling would be a
needed addition to tcp/ip capabilities of gawk, to make it usable as a
client on real internet conditions.

Happy new year,

Haris.

Στις 01-01-2008, ημέρα Τρι, και ώρα 05:34 +0200, ο/η Aharon Robbins
έγραψε:
> There is no way at the moment for bad tcp/ip addresses to be non-fatal.
> 
> I am strongly considering changing the source code.  If you are desperate
> for a patch let me know.
> 
> Thanks,
> 
> Arnold
> 
> > Date: Sat, 29 Dec 2007 14:56:48 +0200
> > From: Haris Makripodis <address@hidden>
> > Subject: Gawk: Trap/handle a fatal error on tcp/ip networking
> > To: address@hidden
> >
> > Hello to all,
> >
> > I am trying to make a simple gawk program that tests and purses html
> > pages using gawk's built-in network support.
> >
> > Code:
> >
> > #!/usr/local/bin/gawk -f 
> > BEGIN { 
> >     RS = ORS = "\r\n" 
> >     site = "www.wrong-url-for-test.com"
> >     port = 80 
> >     uri = "" 
> >     service = "/inet/tcp/0/"site"/"port 
> >     print "GET " uri |& service 
> >     while ((service |& getline) > 0) print $0 
> >     close (service) 
> >     # command 1 
> >     # command 2 
> >     # command 3..... 
> > }
> >
> > My problem is that I 'm trying to find a way of trapping fatal errors in
> > case that the target ip is not valid. For example if I run the above
> > code, it returns 
> >
> > gawk: ./gawktest.awk:8: fatal: can't open two way socket
> > `/inet/tcp/0/www.wrong-url-for-test.com/80' for input/output (No such
> > file or directory)
> >
> > My aim is to prevent this fatal error and handle it accordingly so as to
> > continue processing to the other parts of the programm (#command
> > 1,2,3... on my example) .
> >
> > The only solution I found so far is described on the below url:
> > http://groups.google.com/group/comp.lang.awk/browse_thread/thread/199ec020622eb691/27265a32f1be8475?
> >
> > Is there another way of handling this error?
> >
> > I wonder why tcp/ip connectivity issues should be FATAL in a first
> > place.. 
> >  
> > Thank you for your time,
> >
> > Best regards
> >
> > Haris





reply via email to

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