LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP write buffer problem...

Solved!
Go to solution

This is a real newbie question, but here it is...

 

I'm connecting to a device using the TCP vi's.

 

Here's the problem... if I write "12345" (5 chars) all is good. Then if I write "ABC" (3 chars) the device is receiving "ABC45" (5 chars). Its like the write

buffer isnt being reset. It still contains what was written previously. The device I'm talking to doesnt like CRLF pairs, so thats not an option.

 

On a related note... I'm using the TCP vi's for this. Its just a plain TCP\IP connection.

Should I stick with the TCP vi's or use VISA vi's instead?

 

On one more related note... Does LV have a null character (\0)? I was told that that the device uses the null char to determine the end of the command.

Maybe thats my problem.

0 Kudos
Message 1 of 4
(3,891 Views)

Hi WayneS1324,

to what type of device are you connected? Could it be, that you receive the 3 Bytes correctly, but don't overwrite the 2 other bytes? Did you test your vi on your local pc? You can use the tcp server example for it.

 

Can you show the code you have used for your test?

 

Mike

0 Kudos
Message 2 of 4
(3,885 Views)

Thanks for the replay Mike.

 

Unfortunately I can't post code or any other information. I'll have to rely on my explanatory skills (which are lacking!).

 

If I send "12345" and then "ABC" I can verify that the "ABC" is sent and the device receives "ABC45".

 

I'm thinking that my answer may be the null character but I cant seem to find that in LV and the TCP write only accepts strings.

 

I appreciate the patience... the fact is I know next to nothing about TCP. I've just been thrown into the deep end of the pool.

 

[EDIT] I wrote some test code (PC to PC) and it did seem to work that way. It could be that the device needs its read buffer flushed.

 

 

0 Kudos
Message 3 of 4
(3,882 Views)
Solution
Accepted by topic author WayneS1324

I found the null char. A string constant set to hex display 0x00.

 

I'll try that.

0 Kudos
Message 4 of 4
(3,879 Views)