LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong offset value of "Write File.vi"

Hi LVers,

to log incomming UDP messages I am using two files. The header (fixed
length) is stored in the first file and the message body (variable
length) is stored inthe second file. As an extension to the header
information I want to store the sctual offset (position of the file
pointer) of the datalog file. The "WriteFile.vi" is giving this
information as an output value.

While reading the headerlog I saw that the output value is sporadically
the same for two or three calls of the VI.

Thanks in advance for any help.

Hans J"org Beesterm"oller
0 Kudos
Message 1 of 3
(2,725 Views)
"H.J. Beestermoeller" wrote:

> Hi LVers,
>
> to log incomming UDP messages I am using two files. The header (fixed
> length) is stored in the first file and the message body (variable
> length) is stored inthe second file. As an extension to the header
> information I want to store the sctual offset (position of the file
> pointer) of the datalog file. The "WriteFile.vi" is giving this
> information as an output value.
>
> While reading the headerlog I saw that the output value is sporadically
> the same for two or three calls of the VI.

If I understand properly, the general issue is whether or not the Write
File node faithfully returns the proper offset output every time it is
called?

A more detailed description of when you're writing, when you're writing,
and when y
ou're seeing the problem would help. Is it possible that you're
inadvertently trying to write empty strings using Write File, producing the
identical offset values?

Regards,
John Lum
National Instruments
0 Kudos
Message 2 of 3
(2,725 Views)
Hi again !

It seems that the description I gave was too short, sorry.
Let me try to give a more detailed one.

If no error occurs while creating the two log files (header and data
log) the "Log.VI" enters a while-loop, where it is waiting for an
incoming UDP-packet. In the case of any error, e.g. timeout, the files
are closed and the logging will be stoped.

If there is no error, the packet content will be casted to an U16 array.
The first 10 words (fix length) will be stored in the header log and the
rest of the packet in the data log. The the actual offset of the data
log file will be added to the header log.
The actual "offset" to the start of the data logfile is returned by the
"write to file.VI". This value is stored in a shift register of the
while loop.

What I observe is, that all incoming data is written correct (UDP
packets include a sequence count), but the offset of the datalog, stored
in the header log, is now and then the same for two or three packets.
The following values are valid.

The rate of incoming packets is: 5 packets per 12,5 ms, with a max of
1kbyte per packet.

I'm working under WINNT 4.0, SP5, LV 5.1.1.


Thanks for any help.

Hans Joerg





John Lum schrieb:
>
> "H.J. Beestermoeller" wrote:
>
> > Hi LVers,
> >
> > to log incomming UDP messages I am using two files. The header (fixed
> > length) is stored in the first file and the message body (variable
> > length) is stored inthe second file. As an extension to the header
> > information I want to store the sctual offset (position of the file
> > pointer) of the datalog file. The "WriteFile.vi" is giving this
> > information as an output value.
> >
> > While reading the headerlog I saw that the output value is sporadically
> > the same for two or three calls of the VI.
>
> If I understand properly, the general issue is whether or not the Write
> File node faithfully returns the proper offset output every time it is
> called?
>
> A more detailed description of when you're writing, when you're writing,
> and when you're seeing the problem would help. Is it possible that you're
> inadvertently trying to write empty strings using Write File, producing the
> identical offset values?
>
> Regards,
> John Lum
> National Instruments
0 Kudos
Message 3 of 3
(2,725 Views)