LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Data Packets using TCP Protocol

Hello everyone,

I have an application that needs to send CMD commands to it over TCP.

The Command message have the format in The table attached.

 

I'm using this VI attached and when i monitor the port using CMD "NetStat" I see that communication is established but commands couldn't be sent.

 

So i susptect that data packets are not sent in the right way.

 

Can i have help here with it?

 

Best regards,

Ahmed

 

Download All
0 Kudos
Message 1 of 6
(2,983 Views)

Here are several resources that might be useful in implementing your code

 

http://www.ni.com/white-paper/3098/en/

http://www.ni.com/white-paper/2710/en/

Applications/Systems/Test
National Instruments | AWR Group
0 Kudos
Message 2 of 6
(2,934 Views)

Hi again,

 

Thanks so much for the links, , I 've modified the code tb as attached.

The main code contains a simple TCP communication and the CMD VI contains an implementation for the CMD packet.ly

 

but it didn't work! what I'm sure about is that there a communiation established between the server and client VI.

Download All
0 Kudos
Message 3 of 6
(2,898 Views)

Hi again,

 

I modified the code to be event-driven and it gave me error (56)!

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

There are two thinks as I see it.

 

You are sending 17 bytes over the network, but these number of bytes do not correspond to anything in the table.

 

And you are expecting to read 484 bytes, where did you get that number from ?

 

You are probably sending the wrong format of the command, and therefore you are not receiving any bytes back, and the read function is generating a time out error.

0 Kudos
Message 5 of 6
(2,871 Views)

The data mask of the command frame shall be 18 bytes as the the table attached above.

 

I had an error of sending only 17 bytes and that made some conflictions with the receiver.

 

I found a parameter supposed to be 2 bytes but it was sent as 1 byte when fixed all are ok 🙂

 

Now i've to make a mask for the incoming data from server to be handled.

 

0 Kudos
Message 6 of 6
(2,856 Views)