LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication with multiple workstation.

Hi,

 

I have project involving tcp/ip communication between server and 10 workstations, I need to send command to workstation and in some cases wait for answer and on other it will tak too long to execute action on workstation so I will need to recived msg later. Im thinking about consumer producer architecture where I will put GUI action in one loop and send/recive in other loop. Im just wondering what will be the best solution to recive output from workstation becouse sometimes is only few bytes and sometimes is much more, should I create listeners on 10 ports or just use one and do some header info for workstation recoginsion?

 

Thank you.

http://www.krzysztofszewczyk.net
0 Kudos
Message 1 of 4
(2,448 Views)

I would suggest using UDP, instead of TCP.  Then you can braoadcast the data, and use an address byte at the front to determine if the message is for one machine or another.  If the data is really large, this may not be the right solution.

 

In any case, try and keep it asynchronous.  Forget about one or ten workstations being your target.  Design the code so that it has a dedicated connection handler, with a dedicated service port.

 

Say you use port 9090 for connections.  Each workstation will use this port to connect, the only message given on this port is which port to use for communication.  That port is then reserved for that particular workstation, with a timeout.  You could also add a passphrase if security is a concern.  Then the connection is closed, and the listener is restarted for the next connection.

Machine Vision, Robotics, Embedded Systems, Surveillance

www.movimed.com - Custom Imaging Solutions
0 Kudos
Message 2 of 4
(2,423 Views)

Thanks, I will write some kind of tcp/ip server.vi and inside it I will just recive msg and sent them by queue to another vi for decoding this way I wont lost any msg and I will work async.

http://www.krzysztofszewczyk.net
0 Kudos
Message 3 of 4
(2,405 Views)

You don't need to create 10 listener. As soon as any listener will come using you listen TCP connection you need to create one child VI which will read the data independently. This independent child VI will be reentrant VI

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 4 of 4
(2,401 Views)