LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP read /write

Solved!
Go to solution

ok thank you so much. i actually open my TCP connection in the Loop because i want to place an event structure in my first Loop that will help me to send different request to my device when i click on a particular event.

 

 

0 Kudos
Message 11 of 32
(1,486 Views)

HI you are right, thats just what i did and it works. but the second Loop is faster than the first because i added an event structure in my first loop. How can i make the two loops to work individually. each at its own rythm

0 Kudos
Message 12 of 32
(1,463 Views)

Hallo,

 

i want to use my TCP connection in a bidrectional way to read and write using the same Port and IP Adresse. I want to send data from the client to my server and read back the data from the server to the client.

this is what i have writen, but it does not seem to work as expected. Please can someone help me out?.

 

thanks in advance

Download All
0 Kudos
Message 13 of 32
(1,639 Views)

Create VIs to send and receive messages and use them on both server and client. Sending could consist of prepending a message with the message length and receiving of reading the message length and reading the expected number of bytes.

0 Kudos
Message 14 of 32
(1,621 Views)

HI cordm, 

thanks for your reply. I need to constantly read and write that why i used only one VI

I modified my both VIs as seen below. but i can only read some data coming from the server. i am unable to read all the data coming from the server.

Download All
0 Kudos
Message 15 of 32
(1,612 Views)

You are not doing the same on client and server side. An i32 has four bytes.

Use subVIs, set them to shared clone reentrant.

0 Kudos
Message 16 of 32
(1,588 Views)

Hi Cordm,

thanks for your reply. i donot really figure out what you are saying about using shared clone reentrant

0 Kudos
Message 17 of 32
(1,526 Views)

Hi Natacha_Kam,

 

1. Your server sends the length of the returned data in I32 format - 4 bytes. But the client first reads only 2 bytes, and then tries to typecast them to I32 - this is wrong.

 

2. See the example in "labview\examples\Data Communication\Protocols\TCP\TCP Named Service\TCP Named Service.lvproj" for how to create a listening TCP server.


PS: If you need to read and write TCP frames in the same VI, then why do you even need TCP? You can transfer data directly...

 

 

Message 18 of 32
(1,509 Views)

HI diman27,

thank you for replying. I am confused beacuse in my client i wired 4 as the Bytes to be read. where do you excatly see that i am reading only  2 bytes. 

 

i used the same VI to write and read because my Server is in a different Project and i cannot use an FGV to to directly trasnfer data, except if there is another way to transfer data without using fgv. ( please correct me ,if i am wrong)

0 Kudos
Message 19 of 32
(1,505 Views)

Reading 2 bytes onlyReading 2 bytes only

0 Kudos
Message 20 of 32
(1,498 Views)