NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Active Participant
mfitzsimons
Posts: 695
0 Kudos

Network Published Shared Variables Example

I downloaded NI’s Shard Variable Example (Shared Variable Executable Example.zip) and built the executable.  Note, you need to change the path in the Publisher code to point to the library.  It works fine when they are both run on the same PC.  The issue is I can’t make it work across a network.  Any ideas?  Does this work across a network for anyone else?  I am using LV 8.20 with no DSC.

 

This is what I tried:

·        Both PC’s can ping each other

·        They are both on the same subnet

·        Windows Firewall is OFF

 

Link to example: http://digital.ni.com/public.nsf/allkb/A1767CAD4B99A3A6862572800067436A

 

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
Member
Kevin_H
Posts: 172

Re: Network Published Shared Variables Example

Hey mfitzsimons,
 
I downloaded the program, and was able to get it running.  When you build the exe's, two other files are also created:
 
Shared Variable Publisher.aliases
Shared Variable Subscriber.aliases
 
If you open these files with a text editor, you will see their contents are trivial. 
 
[My Computer]
My Computer=localhost
 
I went into each file, and changed "localhost" to the IP address of the machine running each VI, and made sure both copies of the aliases files are on each computer.
 
For instance, my computer that was running the publisher has an IP address of 10.0.35.222.  I went into the Shared Variable Publisher.aliases file, and made this change:
 
[My Computer]
My Computer=10.0.35.222
 
I changed the other .aliases file to match the IP address of my subscriber, and then copied both aliases files and the subscriber exe over to the other machine, and I was then able to get the program to work correctly.
 
Let me know if you have any questions.
 
Regards,
 
Kevin H
National Instruments
WSN/Wireless DAQ Product Support Engineer
Active Participant
mfitzsimons
Posts: 695
0 Kudos

Re: Network Published Shared Variables Example

Kevin,

Thanks for providing the good answer I needed to my question.  The issue was I couldn't figure out the "magic" that NI was using to make the network connection.  Turns out it is not magic but a configuration.  Where would I find this information?  I search NI for hours and did not find a reference to the information that you provided.  It would of saved a bunch of pain. 

Now I have a working program I can use this to debug why my program won't play across the network.

Thanks

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
Active Participant
faustina
Posts: 216

Re: Network Published Shared Variables Example

I cannot get this example to work at all.  When the VIs run on the same machine, the subscriber responds very slowly to the publisher.  Are there instructions on how to install the subscriber on another PC?
Lithium Technologies
jpaul
Posts: 120
0 Kudos

Re: Network Published Shared Variables Example

Hi Faustina,

 

I was able to open up the VIs on the same machine and get it to work correctly. It may be slow because you have alot of traffic on your network. I have included some steps below in order to communicate to the subscriber on another PC (communicate across the network):

 

  1. Open the project on the Subscriber computer
  2. Right-click on the Boolean Variable and select Properties
  3. In the properties dialog box check the box to enable Binding to Source (we are going to bind this shared variable to a network published shared variable).
  4. Click Browse...
  5. In the browse window change the Network-Published Source to Network Items
  6. Expand the PC on the network that hosts the publisher VI and select the corresponding Boolean Variable
  7. Click OK to exit all dialog boxes
  8. Repeat the steps for the Numeric
  9. Now you should be able to communicate across the network

Let me know if you have any further questions, and refer to the attached screen shots for more information about the above selection steps.

 

Cheers,

 

Jonah

Applications Engineer

National Instruments

Jonah Paul
Marketing Manager, Embedded Software
Evaluate the LabVIEW RIO Platform! - ni.com/rioeval
Active Participant
faustina
Posts: 216
0 Kudos

Re: Network Published Shared Variables Example

I'm missing something very basic here.  I understood that if:

1)   I built the example

2)   change 'localhost' to the appropriate IP addresses in the .alias files

3)   copied the subscriber.alias, subscriber.exe, subscriber.ini and publisher.alias files to the subscriber PC

 

the subscriber.exe would run on the subscriber PC.  Why do I need a project file?

Lithium Technologies
jpaul
Posts: 120
0 Kudos

Re: Network Published Shared Variables Example

Hi Faustina,

 

Sorry for the misunderstanding, I thought that your second computer also had LabVIEW on it and you were running the VI on it. In the case of the executable, you'll want to do as Kevin_H suggests about and once you build the application copy over the *.ini, *.alias and *.exe for the subscriber to your stand alone machine. As far as the delay, I looked into it further and found that in the Publisher.vi there is no wait/delay in the while loop therefore it uses 100% of the processor and does not allow the subscriber to run - thus the long delay. If you add a delay in the publisher loop of 100mS this delay in communication goes away.

 

I did try moving the 3 files associated with the exe over to the stand alone machine changed the IP address in the alias file and was able to communicate.

 

Let me know if you do have any further questions.

 

Cheers,

 

Jonah
Applications Engineer

National Instruments

Jonah Paul
Marketing Manager, Embedded Software
Evaluate the LabVIEW RIO Platform! - ni.com/rioeval
Member
xgatc
Posts: 65
0 Kudos

Re: Network Published Shared Variables Example

Hi, Kevin

 

I wonder if you can explain it a bit more as I tried to do the same, but failed.

 

1).  I have two PCs, lets say,  A=195.914.120.01, the other  B=195.194.122.03

2).  two PCs have LV2010 installed.   I built the publisher, subscriber on PC-A,

 

3)  on PC-A,   now. 

    Publisher.aliases  and Subscriber.aliases both have

             My Computer=localhost

   I changed My Computer="195.194.120.01" for Publisher.aliases and Subscriber.aliases

4) copied Publisher.aliases, Publisher.exe, Publisher.ini, and Subscriber.aliases, Subscriber.exe, Subscriber.ini  to PC-B

   

5)on PC-A, start   Publisher.exe

   on PC-B start  Subscriber.exe

but, change Variable Values on  Publisher FP did not appeared on Subscriber FP.

   exit  Subscriber.exe

6).

on PC-B,   

   I changed My Computer="195.194.122.03" for Subscriber.aliases 

  start  Subscriber.exe agai, the same result as 5)

did I miss anything here ?

I did noticed that there is a line in  Publisher.ini  and Subscriber.ini

   server.tcp.serviceName="My Computer/VI Server"

 

does this affect ?

 

 

cheers

 

 

xiaofeng

 

   

Member
Michael G
Posts: 76
0 Kudos

Re: Network Published Shared Variables Example

 

Hi xgatc,
If I've followed your description correctly, you want the address in your subscriber.alias files to be 195.194.122.03 and the address in the publisher.alias files to be 195.914.120.01.
I don't believe that the server.tcp.serviceName="My Computer/VI Server" line in the ini file is something to worry about as it's not anything I've ever had to modify personally. 
Hope this helps. 
Michael G

 

Michael G.
Applications Engineer
National Instruments
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Self-realization: I was thinking of the immortal words of Socrates, who said, "... I drank what?"
Member
xgatc
Posts: 65
0 Kudos

Re: Network Published Shared Variables Example

Hi, Michael

 

Many thanks for the reply. I did what you said, but still failed.

 

One thing I want to mention is that there is no LV installed on the two PCs,  I made a installer from thrid PC. during building the installer, I selected additional Installer: NI Variable Engine 2.4.0.

 

I have all three

a) Both PC’s can ping each other
b) They are both on the same subnet
c) Windows Firewall is OFF


the details are
=====================
both PCs have firewall turned off

PC-A 
     Dhcp Enabled. . . . . . . . . . . : Yes
     Autoconfiguration Enabled . . . . : Yes
     IP Address. . . . . . . . . . . . : 192.168.147.50
     Subnet Mask . . . . . . . . . . . : 255.255.255.0

PC-B
     Dhcp Enabled. . . . . . . . . . . : Yes
     Autoconfiguration Enabled . . . . : Yes
     IP Address. . . . . . . . . . . . : 192.168.147.52
     Subnet Mask . . . . . . . . . . . : 255.255.255.0

 

from PC-A ping PC-B

C:\Documents and Settings\Harps>ping 192.168.147.52

Pinging 192.168.147.52 with 32 bytes of data:

Reply from 192.168.147.52: bytes=32 time<1ms TTL=128


from PC-B ping PC-A

C:\Documents and Settings\harps>ping 192.168.147.50

Pinging 192.168.147.50 with 32 bytes of data:

Reply from 192.168.147.50: bytes=32 time<1ms TTL=128

 

When I started Publihers on PC-A, I can see the deploying-window. the variable was deployed OK.

But, one thing puzzled me is that how do I know the NI Variable Engine is launched?  or is the NI Variable Engine needed?  

I can not see anything  from TaskManager for processes.(see the attached screen shot)

 

again, thanks for your time.    

 

 

xiaofeng