GAWK 3.1.3 for Windows - cannot get simple TCP going

  • Follow


Hello.
I'm  just learning GAWK 1.3.3 so I took a sample for documentation:

BEGIN {
 "/inet/tcp/120/136.11.28.61/23" |& getline
 print $0
 close("/inet/tcp/120/136.11.28.61/23")
}

type:
C:\Program Files\GnuWin32\bin>gawk -f
\Documents\Programming\Awk\Migration\test.gawk

and get:
gawk: \Documents\Programming\Awk\Migration\test.gawk:2: fatal: can't open
two way socket `/inet/tcp/120/146.11.28.61/23' for input/output (No such
file or directory)

I know  146.11.28.61 host exists and I know it accepts telnet sessions...
So, why isn't it working?
Thanks in advance,
Alex


0
Reply A 6/29/2004 6:04:55 AM

A Ferenstein <epaalx@hotmail.com> wrote:
> Hello.
> I'm  just learning GAWK 1.3.3 so I took a sample for documentation:
> 
> BEGIN {
> "/inet/tcp/120/136.11.28.61/23" |& getline
> print $0
> close("/inet/tcp/120/136.11.28.61/23")
> }

Wild stab in the dark.
Is this supported under linux at all?
0
Reply Ian 7/7/2004 6:52:20 PM


In article <EDXGc.4174$Fc7.749446@stones.force9.net>,
Ian Stirling  <root@mauve.demon.co.uk> wrote:
>A Ferenstein <epaalx@hotmail.com> wrote:
>> Hello.
>> I'm  just learning GAWK 1.3.3 so I took a sample for documentation:
>> 
>> BEGIN {
>> "/inet/tcp/120/136.11.28.61/23" |& getline
>> print $0
>> close("/inet/tcp/120/136.11.28.61/23")
>> }
>
>Wild stab in the dark.
>Is this supported under linux at all?

I'm sorry.  What part of "for Windows" did you not understand?

Anyway:
	1) There are obvious syntax bugs in the above code.
	2) AFAIK, it works only in the Cygwin Windows port.

0
Reply gazelle 7/7/2004 8:24:52 PM

Hello,

>>> BEGIN {
>>> "/inet/tcp/120/136.11.28.61/23" |& getline
>>> print $0
>>> close("/inet/tcp/120/136.11.28.61/23")
>>> }

> 	1) There are obvious syntax bugs in the above code.

though I don't see any _syntactic_ problems with the code, it wouldn't
run on Unix:
1) port 120 is priviledged, so non-root cannot access it.
   Why do you object to having the local port chosen automatically,
   by saying "0", as in the manual?
2) port 23 is somewhat specific, the server doesn't send raw text in
   lines, there is kind of hand-shaking at the start. Any other port
   is better.
3) It's wise to save the long string in a variable, to be sure that you
   are closing the right thing.

What about this:

BEGIN {
serv = "/inet/tcp/0/www.google.com/80"
print "GET / http/1.0\n" |& serv
serv |& getline
print $0
close(serv)
}

I have no experience with Windows ports, but I wouldn't waste time by
experimenting with other ports then Cygwin, at least for the first round.

Have a nice day,
	Stepan
0
Reply Stepan 7/8/2004 8:09:51 AM

Kenny McCormack <gazelle@yin.interaccess.com> wrote:
> In article <EDXGc.4174$Fc7.749446@stones.force9.net>,
> Ian Stirling  <root@mauve.demon.co.uk> wrote:
>>A Ferenstein <epaalx@hotmail.com> wrote:
>>> Hello.
>>> I'm  just learning GAWK 1.3.3 so I took a sample for documentation:
>>> 
>>> BEGIN {
>>> "/inet/tcp/120/136.11.28.61/23" |& getline
>>> print $0
>>> close("/inet/tcp/120/136.11.28.61/23")
>>> }
>>
>>Wild stab in the dark.
>>Is this supported under linux at all?
> 
> I'm sorry.  What part of "for Windows" did you not understand?
> 
Sorry, I of course meant "under windows".

> Anyway:
>        1) There are obvious syntax bugs in the above code.
>        2) AFAIK, it works only in the Cygwin Windows port.

The socket handling works under linux, I was just unsure if the 
windows port kept it in.

0
Reply Ian 7/8/2004 11:50:25 AM

4 Replies
206 Views

(page loaded in 0.597 seconds)

Similiar Articles:













7/25/2012 11:21:32 PM


Reply: