キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

LabView TCP/IP advice

Dear all,

 

I need some advice concerning a TCP/IP comunication using LabView - please point me in the right direction.

 

Basicaly, what i am trying to do is to send a command over TCP/IP and receive a feedback/response.

 

The problem that i am encountering is that i cannot see the feedback/response in the LabView vi but i can see it in the wireshark software.

 

The vi code is this :

 

TCP-IP-Comm.png

 

The response from the Wireshark software looks like this :

 

- COMMAND SENT :

 

Wireshark-comand.png

 

 

- FEEDBACK RECEIVED :

 

Wireshark-feedback.png

 

 

Where is the problem ??

 

Thank you very much for taking the time to read my post !

 

Best wishes,

 

Andrei

 

0 件の賞賛
メッセージ1/10
6,640件の閲覧回数

Oookkkkk...so it seems i have to specify how many bytes to read from the port.

 

 

Hmmm...this is a problem...i send a command but the answer may be of variable length.

0 件の賞賛
メッセージ2/10
6,621件の閲覧回数

Do you control both ends of the TCP connection?

 

If you do, then you can prepend the data size onto the packet (as a fixed number of bytes).

 

Then in labview you can read the fixed number of bytes, then pass that number into another READ to grab the actual packet.

 

Deceased

0 件の賞賛
メッセージ3/10
6,600件の閲覧回数
Thank you 4 the answer.
Unfortunately i do not control both ends of the comunication. I just give a command and store the answer.

Is there another solution to this problem ?
0 件の賞賛
メッセージ4/10
6,587件の閲覧回数

Since I am not at work and don't have LabVIEW installed on my home PC, the only advice I'd give it to get rid of the FOR LOOP & the 10 second wait. They do nothing.

0 件の賞賛
メッセージ5/10
6,571件の閲覧回数

Any documentation on the packet format for the other device?

 

It might embed a data size somewhere that you can access.

0 件の賞賛
メッセージ6/10
6,563件の閲覧回数
Does the response end with a new-line character (many text-based protocols such as HTTP do this)? If so, you can read up to the end-of-line.
0 件の賞賛
メッセージ7/10
6,542件の閲覧回数

@nathand wrote:
Does the response end with a new-line character (many text-based protocols such as HTTP do this)? If so, you can read up to the end-of-line.

Its a dangerous game since the message may well contain a 0x0D / 0x0A that is part of the data rather than a CRLF. I have seen this happen many times where a device is transmitting measurements as hex values.

0 件の賞賛
メッセージ8/10
6,536件の閲覧回数

@deceased wrote:

@nathand wrote:
Does the response end with a new-line character (many text-based protocols such as HTTP do this)? If so, you can read up to the end-of-line.

Its a dangerous game since the message may well contain a 0x0D / 0x0A that is part of the data rather than a CRLF. I have seen this happen many times where a device is transmitting measurements as hex values.


Not dangerous at all if that is the format of the response!  (Unless the protocol was so poorly written that the data is binary, yet specifies EOL as the end of the message - but that's a whole 'nuther issue.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 件の賞賛
メッセージ9/10
6,511件の閲覧回数

Yes, I must admit, on all occasions where I have seen data transmitted as hex, the TCP packet contained a fixed length header which indicated datasize.

0 件の賞賛
メッセージ10/10
6,499件の閲覧回数