SLAS

Sending and Receiving Serial Data over the Internet

From LabAutopedia

Jump to: navigation, search

Authored by Tom Lutz, TALtech - instrumental software solutions.

Contents


One function of routers and similar devices

Most PCs that are connected to the Internet are not connected in a manner where the PC's IP Address is visible to the rest of the Internet. In most cases the PC will be connected to a router or similar network device that is connected to the Internet and the router will assign "local IP addresses" to all PCs that are connected to it creating a "local network". The router shields all the workstations in the local area network from the rest of the Internet by not allowing TCP/IP connections directly to the workstations within the network. The router's IP Address is visible to the rest of the Internet, however when you run software that connects to resources on the Internet (web pages, email servers, etc.), the router actually establishes all TCP/IP connections for you and "routes" all data between the connected client workstations and the external servers out on the Internet.

Network device configuration

Because almost all TCP/IP connections from a workstation are initiated as "client" connections, where some client software specifies the IP Address or URL of the server that it wants to connect to, no special configuration of the router needs to be performed. The router will keep track of all outgoing client requests and automatically "route" all data received from a server back to the specific client workstation that established the connection. In other words, if you configure an RS232-to-TCP/IP converter device server as a TCP/IP "client" where it will connect to a specific IP address and port number for a server located somewhere on the Internet, you do not need to make any configuration changes in your router. It is only when you want to run an RS232-to-TCP/IP converter as a TCP/IP Server on a workstation that is behind a router that you will need to change your router configuration to allow this to happen.

All routers are configurable to support a feature called "Port Forwarding". Port Forwarding is basically a way for a router to map TCP/IP client connections that are established directly to the IP Address of the router (i.e. the IP Address that is visible to the rest of the Internet) and forward them on to a TCP/IP Server running on a workstation within the local area network behind the router (i.e. a workstation IP Address that is not visible to the rest of the Internet). RS232-to-TCP/IP Server hardware can both be used to send and receive serial data over the Internet, however you will almost certainly need to re-configure your network router hardware to make this possible.

For example, suppose that you want to run an RS232-to-TCP/IP converter (hardware or software) as a TCP/IP server where it is listening for connections on port 1000 on a workstation that has a local IP address of 192.168.1.100 and is connected to the Internet through a router. 192.168.1.100 is a local IP address that was assigned by your router and therefore it is not visible to the rest of the Internet. In order for a TCP/IP client that is not part of your local area network (i.e. a client somewhere out on the Internet) to be able to connect to the server port on which the server is listening, you would first need to configure your router to "forward a port" from the router's IP address to port 1000 of the IP address of the local workstation where the RS232-to-TCP/IP server is running (in this case 192.168.1.100). You would then need to configure the TCP/IP client (located somewhere out on the Internet) to connect to the IP address of the router using the port number that was forwarded. This means that you will also need to know the IP address of the router, which is typically assigned by your Internet Service Provider (ISP).

Fortunately, all routers are easily configured to implement port forwarding, however they are not all the same. You will need to learn how to configure your particular router using your hardware's documentation. Most routers are configurable using a common web browser and the configuration steps are fairly easy. You should also be able to use the router's configuration interface to find out the IP address that the router is using for connection to the Internet. You can also find out your router's IP address using the following web page: http://www.ipaddressworld.com . To find out your local IP address using a Windows® operating system, open a Command Prompt window (select Start - Program Files - Accessories - Command Prompt) and enter the command: IPCONFIG.

The following web site is an excellent place to learn more about "port forwarding" as well as to learn how to configure different makes and models of routers: http://www.portforward.com

Firewalls and other issues

Other things that may affect your ability to connect to an RS232-to-TCP/IP server across the Internet are Firewalls, as well as the fact that most router IP addresses are assigned dynamically by your ISP. If your router's IP address is assigned dynamically, then the router's IP address could change depending on how your ISP implements the connections. You may be able to contact your ISP and request a "Static IP Address" for your router so that it's IP address never changes. Another issue is that your router may also be configured to dynamically assign local IP addresses to the workstations in your local network. If this is the case then the IP address of your local workstation could also change. To get around this, you should also be able to configure your router or operating system to use a static IP address for your PC instead of having the router automatically assign a dynamic one.

Firewalls are either software or hardware based security systems that are designed to block outside access to TCP/IP ports. Windows® XP has a built-in firewall that will normally block access to TCP/IP ports unless you specifically grant access to those ports in the Firewall settings. Fortunately the Windows Firewall will normally prompt you to grant outside access to a TCP/IP server port as soon as the TCP/IP server software starts "listening" for client connections. For example, if you configure an RS232-to-TCP/IP converter to run as a TCP/IP Server, as soon as you activate it the first time, the Windows® XP Firewall software will pop open a window asking you if you want to allow external connections to the server. Once you allow connections to a specific server application, Windows® will remember your selection so that you do not have to enable connections each time you start the server. You can also manually configure the Windows Firewall in your control panel to allow external client connections to specific application programs.

The following web site is an excellent place to learn more about Firewalls including how they work and how to configure them to allow connections to get through: http://www.firewalling.com .


Click [+] for other articles on 
Electronic interfaces(11 P)
The Market Place for Lab Automation & Screening  The Market Place