[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Gawk: Trap/handle a fatal error on tcp/ip networking
From: |
Aharon Robbins |
Subject: |
Re: Gawk: Trap/handle a fatal error on tcp/ip networking |
Date: |
Tue, 01 Jan 2008 05:34:13 +0200 |
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