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

[Support #KIS-841562]: Reading from STDIN with LDM



Stacey,

> Hi, my name is Stacey Simmons and I work under Rob Parsons at
> WeatherTAP.  I've been having some problems reading from STDIN in a
> process that gets kicked off by an LDM PIPE command in the pqact.conf
> file.  I know you are a busy man and probably do not have any spare
> time.  I would really appreciate it if you could give me some input as
> to what you think might be happening.  Here is the situation.  I've
> written a tropical weather decoder that decodes the WTNT2 and WTNT3 text
> products.  These products are sent to my decoder with the following
> command in the pqact.conf file:
> 
> WMO     ^(WTNT[2-3].)
> PIPE    /usr/bin/perl /wxhub/decoders/tropProdGen/tropProd.pl
> 
> In the decoder I open STDIN and read in a line at a time using the
> <STDIN> command.  Once I reach the "$$", I send the data that I have
> read to a decoding function.  Once it finishes decoding, I come back and
> read from STDIN again.  The problem I'm having is that when I come back
> from my decoding function and try to read STDIN, there is nothing there
> to read even though there is about 5 more lines left in the product I'm
> reading.  I let the decoder run for up to 10 minutes waiting on STDIN.
> What I have noticed is that the rest of the product I was reading only
> comes in when a new product gets sent to my decoder.  Do you know why
> this would occur?  For instance, I receive a WTNT2 product and when I
> reach the "$$" in the data, I send the data on for decoding.  After
> returning form decoding, I'm trying to finish reading what is left of
> the WTNT2 product from STDIN, but it acts like nothing is there to
> read.  A couple minutes later I get the WTNT3 product sent to this same
> instance of my decoder and it then reads the rest of the WTNT2 product,
> but my not read all of the WTNT3 product that was just sent.  Does this
> make sense?  Do you have any idea what might be causing this?  I've
> attached the perl code that is called when data is sent to my decoder.
> Again, any help or insight you could give me on why this is happening
> would be greatly appreciated.

Try using the "-flush" option of the PIPE action to flush the
buffer between the pqact(1) process and your decoder.  For more
information, see 
<http://www.unidata.ucar.edu/software/ldm/ldm-current/basics/pqact.conf.html>.

> Thank you,
> Mr. Stacey Simmons
> WeatherTAP.com

Regards,
Steve Emmerson

Ticket Details
===================
Ticket ID: KIS-841562
Department: Support LDM
Priority: Normal
Status: Closed