LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about creating server

I have a Linux device I am setting up as a client to connect to a PC that is set up as a server.  I call RegisterTCPServer() in a Labwindows program on the PC.  I am observing that the Linux device (client) needs to be powered up prior to calling RegisterTCPServer() or the Labwindows program never works.  

 

For example, I set the IP on the PC to 10.1.10.22.  With the Linux device powered off and I call RegisterTCPServer() and then call GetTCPHostAddr(), the return IP is different than 10.1.10.22 and I can never set the PC as a server.

However, if the Linux device is powered up first, GetTCPHostAddr() returns the correct IP (10.1.10.22) and I am able to set the PC up as a server and communicate successfully.

How can I modify the Labwindows code so it can be running prior to powering on the client and successfully work as a server?

Thanks 

0 Kudos
Message 1 of 4
(2,395 Views)

Hi

 

I think this is a network issue and not a CVI issue. How are the PC and the device connected? Directly or via a switch. If the PC is not connected to anything (device power off), it may not report the correct IP, but the alternative IP. Check your IP using ipconfig or similar tool to check the IP of the PC when device is off.

Use a switch if not already installed.

 

0 Kudos
Message 2 of 4
(2,367 Views)

Thanks for the reply.

I assigned a static IP to the PC by editing TCP/IPv4 properties in Windows.

With no device connected to the PC, if you run a Labwindows program and call GetTCPHostAddr(), it will return with a host address that is different than the static IP you configured your PC with.  Why does this happen?  How can I modify the Labwindows code to setup as a TCP server with the static IP assigned to the computer? 

0 Kudos
Message 3 of 4
(2,357 Views)

Hi,

Maybe the functions GetAllTCPHostAddresses () and RegisterTCPServerEx () can help you.

0 Kudos
Message 4 of 4
(2,347 Views)