The output record format from TCPLISTEN is identical to the input record
format for TCPDATA; in fact the documentation is imbedded from a common
script file.  So what you see with TCPDATA is the format of the second and
following record from TCPLISTEN GETSOCKNAME.  The first record contains the
sockaddr_in structure:  2 bytes identifier AF_INET, 2 bytes port number, 4
bytes IP address, and 8 bytes pad.

No, I didn't write ISONSRV.

The comment on the second line of the example in PIPE HELP TCPLISTEN is
downright wrong.  It is the first record, not the second.  Maybe this is the
reason for your confusion.  Thus the LOCATE stage (which the author no doubt
inserted in desperation) should have been DROP 1.  Also note that the
example processes a single request; probably not what you want in real life.

pipe tcplisten 10000 getsockname|take 1|c2x|cons
00022710 00000000 00000000 00000000
Ready; T=0.02/0.02 12:58:08

The IP address of all zeros indicate that you wish to bind to all
interfaces.  LOCALIP ANY.  TCPLISTEN terminated immediately because of TAKE
1.  I did not have to connect to the port for it to stop; in fact, I would
not be able to because the socket is bound, but no listen() was ever active.

Broken piece of the four stages from l: can be writen directly with 1.1.12
as

|spec /Started on port/ 1 print c2u(record(3, 2)) strip nw /./ n

and you even get a trailing period (but I didn't test this one).

   j.

On 26 February 2010 17:22, Ian S. Worthington <[email protected]>wrote:

> I wasn't aware of pipe ahelp -- the error's in the cms help pipe
> documentation
> in the ISONSRV example.  Maybe not yours then.
>
> I've found the format of the first record appears to be documented in the
> tcpdata stage.  Maybe a link to that would suffice.
>
> i
>
> ------ Original Message ------
> Received: 01:41 AM COT, 02/26/2010
> From: "John P. Hartmann" <[email protected]>
> To: [email protected]
> Subject: Re: tcplisten output record not as defined in help?
>
> > Nothing has changed for quite a while.
> >
> > With GETSOCKNAME, the first output record is a 16-byte sockaddr_in
> structure
> > returned by bind().  This is documented with the description of the
> option,
> > but I should also document that format in the Output Record Format
> section.
> > Thanks for the reminder.
> >
> > I cannot see any SPECS in the TCPLISTEN article I wrote.  You did say
> PIPE
> > AHELP TCPLISTEN, right?  And you did get the latest HELPLIB from Marist?
> > (Yes, Will wrote a bit of fiction in HELP PIPE TCPLISTEN, though it looks
> as
> > if he cut'n'pasted most of it from the AHELP.)
> >
> > If you get EADDRINUSE issue NETSTAT ALLCONN to see what state the port is
> > in.
> >
> >    j.
> >
> > On 26 February 2010 01:46, Ian S. Worthington
> <[email protected]>wrote:
> >
> > > This is what I've found:
> > >
> > > 1. The first record emited by tcplisten getsockname has a different
> format
> > > from the others.
> > >
> > > 2. The only documentation appears to be in the help pipe tcplisten,
> which
> > > is
> > > slighty wrong:
> > >
> > > specs 14 c2d 1
> > >
> > > should be
> > >
> > > specs 1.4 c2d 1
> > >
> > > 3. Although this sample server doesn't stop after processing a client
> > > request
> > > it has to be manually stopped/started: the second invocation of the
> clients
> > > returns EADDRINUSE -- not sure why yet.
> > >
> > > i
> > >
> > >
> > > ------ Original Message ------
> > > Received: 12:51 PM COT, 02/25/2010
> > > From: "Ian S. Worthington" <[email protected]>
> > > To: "CMS Pipelines" <[email protected]>
> > > Subject: Fwd: tcplisten output record not as defined in help?
> > >
> > > > The record output from tcplisten doesn't seem to be as defined in the
> > > help
> > > > text, nor wors with the ISONSRV example.
> > > >
> > > > Has it been changed?
> > > >
> > > >
> > > > pipe tcplisten 0     getsockname | console  | specs 1-* c2x 1 |
> console
> > > >    "
> > > > 0002107F000000000000000000000000
> > > >
> > > > ian
> > > > .
> > > > Ian S. Worthington, MBCS
> > > >
> > > >
> > > >
> > >
> >
>

Reply via email to