Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Sockets as filenames.
Ian Stirling wrote:

> Or absolutely ideally, for all files in
> awk -f whatever.awk /inet/tcp/... /inet/tcp/... /home/me/file

Now I see what your problem actually was.
/inet/tcp has a meaning inside GNU Awk;
outside (in the realm of any shell) it
has no meaning. But even inside GNU Awk
sockets must be handled differently than
files.

When I started implementing socket access
in GAWK, I actually wanted to implement it
just the way you expected it (access with
"<" and ">"). But our honorable Maintainer
convinced me to implement socket access in
a different way ("|&"). The reasoning goes
like this: GAWK remembers if a "file" was
accessed with "<" or ">". These are one-
directional accesses (either read or write,
but not both). Sockets dont fit into this
scheme, therefore Arnold told me to use the
"|&" syntax, which was prepared for two-
directional access. This really makes sense
from an implementer's perspective.

From a user's perspective, I was never happy
with the "|&" syntax because users (like you)
expect things to work in a uniform way.

> More generally, it'd be nice if everything that could be done
> with ARGV/FILENAME/... to choose the upcoming filenames 'just worked'
> with sockets.

Indeed.

> It already (seems to be from the limited testing) half-way there, with
> normal input processing working just fine, only with the anomaly that
> in this case, two sockets with identical names don't read and write
> correctly.

The files with identical name are not much better.

> On linux at least, /dev/tcp doesn't work.

I think Arnold forgot to mention that /dev/tcp is
a feature of the new Korn Shell (ksh93) and not
a feature of GNU Awk. Therefore, you can expect to
see a working /dev/tcp only if your shell is ksh93
compatible.

Report this thread to moderator Post Follow-up to this message
Old Post
Jürgen Kahrs
09-24-04 08:55 AM


Re: Sockets as filenames.
In article <2rgk3dF1a9f3bU1@uni-berlin.de>,
examnotes  <Juergen.KahrsDELETETHIS@vr-web.de> wrote:
>Ian Stirling wrote:
> 
>
>Now I see what your problem actually was.
>/inet/tcp has a meaning inside GNU Awk;
>outside (in the realm of any shell) it
>has no meaning. But even inside GNU Awk
>sockets must be handled differently than
>files.
>
>When I started implementing socket access
>in GAWK, I actually wanted to implement it
>just the way you expected it (access with
>"<" and ">"). But our honorable Maintainer
>convinced me to implement socket access in
>a different way ("|&").

Editorial note: I'm not sure what the exact "state" of this discussion is,
and I don't want to get mired in it.  I will just state that I think that
Ian has been arguing in circles with himself, but beyond that I don't care.

I am stepping in only to point out that ">" does work with sockets (as
long, of course, as the communication is one-way).  My program contains:

sock="/inet/tcp/..."
print data > sock;close(sock)

and it works just fine.


Report this thread to moderator Post Follow-up to this message
Old Post
Kenny McCormack
09-24-04 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

AWK archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:26 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.