ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP read and write simultaneously

I'm new to TCP communications, so please correct me if you see mistakes.

 

I'm trying to read analog voltages and send the data out as a TCP packet.  I've successfully done this.

 

However, I want to also be able to read an incoming TCP packet and generate a digital signal.  I'm not sure how to do this.

 

I've attached the files below.  I simply tried to use the same connection ID and a TCP Read.vi.  This portion of the code is located at the lower left corner of the timed-loop.

 

Does this look correct?  I am not convinced this will work.

Fred
*Kudos are appreciated.*
0 Kudos
Message 1 of 5
(4,906 Views)

Hi FLng,

you can read and write simultanelously. You can build a connection from client to server, then you can write from client to server and from server to client. In you case i don't see the second writer. Where do you get the data from which you want to read in your timed loop?

 

Mike

0 Kudos
Message 2 of 5
(4,864 Views)

I have a blog post (link below) which covers this - look for "Beginner's Guide to TCP".

 

In short, a TCP connection is like a telephone connection: you can send both ways without problems.

You use the same CONN ID to go both ways. 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 3 of 5
(4,858 Views)

MikeS81,

 

You were right.  I forgot to include the other TCP write.  I've figured out the communication.  Thanks for the response.

Fred
*Kudos are appreciated.*
0 Kudos
Message 4 of 5
(4,793 Views)

Steve,

 

Thanks for the response. I've figured out the TCP communication, but read your link anyways.  I think you did a really good job breaking the TCP communication down to simple basics.

 

 

To all readers who came to this posting trying to learn about TCP communication,

 

Read Steve's description at http://tipsandtricks.culverson.com/?p=8

Fred
*Kudos are appreciated.*
0 Kudos
Message 5 of 5
(4,790 Views)