09-13-2010 04:20 PM
I have an application where I need to send data via TCP/IP from two separate machines to a third machine. The machines are on a local area network connected through a network switch. The data are generated independently through data acquisition by the two independent machines before are sent to the client on third machine. Each machine has one network card. Thanks.
Solved! Go to Solution.
09-13-2010 07:02 PM
Have each server listen on a separate port. On the client have two loops, each loop attempts to open a connection using the IP address of one of the servers on its respective port. I have this working currently, including the ability to re-connect automatically if a connection is lost. I could put together a stripped down example for you if you need it.
It is based upon the STM framework, you will need to find that on the NI website and download it. It includes some great examples.
09-14-2010 07:26 AM
Thanks TLE!
I'd appreciate it if you could point me to the link on NI website with the examples, and If this was not too much troubles for you, a strip down example would also be appreciated. Meanwhile I'll try to make it work using your advice. Thanks again!
09-14-2010 07:46 AM
Hi Larrage,
you'll also find very got examples in the example finder. Search for TCP/IP and you'll get a list of VI's with Client and Server solutions.
Mike
09-14-2010 09:45 AM
If you have three separate machines, you don't need to use separate ports. They will have three IP addresses.
Remember this rule: TCP connections are EXACTLY like telephone connections.
Have your client open two connections: same port on two different IP addresses.
Each client listens for connections.
After connections are established, you get to decide the protocol: maybe the client should explicitly ask for data, maybe the servers just dump it without being asked. It's up to you.
Read this:
Blog for (mostly LabVIEW) programmers: Tips And Tricks
09-15-2010 03:34 PM
Hi Larrage,
Here is a link to the STM library. There is a download link at the bottom
LabVIEW Simple Messaging Reference Library (STM)
09-15-2010 03:44 PM - edited 09-15-2010 03:44 PM
Do you still need me to par down an example? And yes, you can use the same port numbers. Thanks to who pointed that out.
09-16-2010 07:28 AM
Hi TLE,
I just checked out the example pointed by the link. I am OK with it...I will work it through. I've implemented and tested the system using your suggestion yesterday. This forum works.
Thanks for the help!
09-16-2010 07:31 AM
Thanks Joe!
05-18-2012 12:45 PM
Hi TLE,
Please elaborate more on the ability to automatically reconnect. I have a situation where multiple machines need to communicate status to one machine but they are not always on line.
Thanks,
DJ