LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP over Internet

Solved!
Go to solution

I've successfully managed to establish a TCP/IP connection in server/client application between two machines on the same network/subnet, thanks mostly to Mark Yedinak here on the forum.

 

However, I'd like my application to be able to establish a TCP/IP connection over the internet and hence remove the limitation of having to have the two machines on the same subnet.

 

I'm not sure what IP address to provide the client with in order to establish the connection with the server. 

 

To sum up: Machine A, Server, Network 1

                 Machine B, Client, Network 2

 

Can I establish a TCP/IP link between Machine A and Machine B and if so how? 

 

 

 

 

0 Kudos
Message 1 of 32
(4,576 Views)

From a LabVIEW standpoint the code will be the same I think.  The real question is in how the two networks are "linked".  The routers, bridges, proxy servers, and all inbetween the two networks come into play.  Assuming you are not the creator of both networks, you will need to coordinate with the Network Admin on both ends to find out what ports are available and how they want the data passing through "their" network.  If possible some sort of port forwarding would be advantageous here.

 

Wire Warrior

Wire Warrior

Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!
Message 2 of 32
(4,559 Views)

Use the "string to IP" function to do a look up.  So give it an  IP address 146.201.231.114 and get the network id string to you TCP open function.

 

As Warrior said, make sure that whatever host and port is not blocked by a firewall.

Message 3 of 32
(4,546 Views)

Hi,

 

it is possible to configure a NAT (Network Address Translation) router to allow outside clients to talk to a server

 

-->Set the server up as the DMZ host (De-Militarized Zone host). Configuring a DMZ host simply requires telling the router the IP address of the server. The DMZ host will then be completely open to all incoming traffic from the internet. The outside clients would then use the external IP address of the router to talk to the server.

Most routers allow one IP address to be configured as a DMZ host so that all incoming traffic goes to the DMZ host   DMZ (computing)

 

-->Set up port forwarding on the router to forward all TCP ports. The outside clients would then use the external IP address of the router to talk to the server.

 

-->Setup VPN or PPTP to allow the outside clients to tunnel behind the firewall. This will allow the outside clients to act as though they are inside the firewall and they can talk directly to the server.

 

Message 4 of 32
(4,540 Views)

it is possible to configure a NAT (Network Address Translation) router to allow outside clients to talk to a server

 

-->Set the server up as the DMZ host (De-Militarized Zone host). Configuring a DMZ host simply requires telling the router the IP address of the server. The DMZ host will then be completely open to all incoming traffic from the internet. The outside clients would then use the external IP address of the router to talk to the server.

Most routers allow one IP address to be configured as a DMZ host so that all incoming traffic goes to the DMZ host   DMZ (computing)

 

-->Set up port forwarding on the router to forward all TCP ports. The outside clients would then use the external IP address of the router to talk to the server.

 

-->Setup VPN or PPTP to allow the outside clients to tunnel behind the firewall. This will allow the outside clients to act as though they are inside the firewall and they can talk directly to the server.


The answer to the first question is no.  NAT is for outgoing connections to be remapped for a private network.

 

Is your sever on a private network (ie does the IP address start with 10.XXX.XXX.XXX or 192.168.XXX.XXX ?  These are private networks and you can set up port forwarding at your router as in item 2.  So that all incoming traffic on your server port is routed to the server port to the correct host.

 

 

To have an exposed server to get around a firewall you need to do one of these options.   If it is a firewall for a public (not private) IP net then you need to poke a hole in the firewall for that host

Message 5 of 32
(4,536 Views)

@sth wrote:

it is possible to configure a NAT (Network Address Translation) router to allow outside clients to talk to a server

 

-->Set the server up as the DMZ host (De-Militarized Zone host). Configuring a DMZ host simply requires telling the router the IP address of the server. The DMZ host will then be completely open to all incoming traffic from the internet. The outside clients would then use the external IP address of the router to talk to the server.

Most routers allow one IP address to be configured as a DMZ host so that all incoming traffic goes to the DMZ host   DMZ (computing)

 

-->Set up port forwarding on the router to forward all TCP ports. The outside clients would then use the external IP address of the router to talk to the server.

 

-->Setup VPN or PPTP to allow the outside clients to tunnel behind the firewall. This will allow the outside clients to act as though they are inside the firewall and they can talk directly to the server.


The answer to the first question is no.  NAT is for outgoing connections to be remapped for a private network.

 

Is your sever on a private network (ie does the IP address start with 10.XXX.XXX.XXX or 192.168.XXX.XXX ?  These are private networks and you can set up port forwarding at your router as in item 2.  So that all incoming traffic on your server port is routed to the server port to the correct host.

 

 

To have an exposed server to get around a firewall you need to do one of these options.   If it is a firewall for a public (not private) IP net then you need to poke a hole in the firewall for that host


The server is running on a private network, the IP address starts with a 10.XXX.....

 

Not sure I fully understand what you mean in item 2, could you clarify perhaps?

 

Perhaps there is example code somewhere? Couldnt find any in the examples or here on the forum

0 Kudos
Message 6 of 32
(4,528 Views)
Solution
Accepted by Strokes

By #2, I meant the strategy of

 

-->Set up port forwarding on the router to forward all TCP ports. The outside clients would then use the external IP address of the router to talk to the server.

 

Actually I would set up a single port on the router to forward that particular port to the server.  I assume you have a specific incoming port on the server you want to expose to the outside world.  In this case you need to set up "port forwarding" on the router to take an incoming port (like port 20100 and forward it to the correct port on the server).  The client should then be configured to connect on port 20100 with the internet address of the router (not the internal 10.XX.XX.Xx address)

 

This is not example code for labview.  I assume you have a TCP client server running as was stated.  But this is router configuration a non-LV subject.

Message 7 of 32
(4,520 Views)

Hi ,

 

to make a long story short : Port forwarding allows remote computers (for example, computers on the Internet) to connect to a specific computer or service within a private local-area network (LAN)

National Instruments does not directly support how to set up your specific router with the options mentioned above

Message 8 of 32
(4,494 Views)

Right.  But as a non-NI person I give advice....   But setting up a router depends on the style of router etc. and can vary widely.  In this case go to the router configuration page and look for something about port forwarding.  You will have an external port and an internal port and IP address to connect to.  Thus any incoming access to the router public IP address on that external configured port will be forwarded to some internal address on the internal port you configured.

 

Message 9 of 32
(4,476 Views)

Or just ask your network administrator or/and consult the manuals of the router and specific software packages.

 

Ensure that your firewall is setup with the proper exceptions to allow this connection. If using Windows 7, be careful to ensure that the exceptions to the firewall are either setup for all network locations

i.e. Public, Private....

Message 10 of 32
(4,473 Views)