Using Digi Realport with Python

From Digi Developer

Jump to: navigation, search

Digi Realport is a set of operating system drivers which make remote IP-based serial ports appear as local physical ports. Traditionally Digi Realport uses TCP/IP only and talks to a very special low-level driver in Digi products. Unfortunately, at present these low-level drivers in products such as the X4 and X8 gateways literally expects to talk to the hardware serial ports. Thus there is no way to connect standard Digi Realport to a Python script.

However the latest versions of Digi Realport for Windows has added a UDP mode which ONLY moves serial data, emulating a 3-wire RS-232 cable. The data it sends is well packed into a single UDP packet and works very well with protocols such as Modbus or Rockwell DF1. Since none of the Digi Realport protocol is included, any Python script can wait on the UDP socket and interact with a remote Windows-based host application.

Contents

Supported Products

  • Digi Realport for Windows 2000/XP/Vista (such as P/N 40002549_C.zip) Older versions of Windows won't have UDP support.
  • Any Digi product with Python

Setting up Digi Realport under Windows

Download the latest version of Digi Realport. This July-2008 version is for XP/2003/Vista/2008 both 32/64 bit - ver. 4.2.360.0. See http://www.digi.com/support to confirm you have the latest versions. http://ftp1.digi.com/support/driver/40002549_D.zip

Unpack (unzip) the files in a suitable directory. Run the SETUP.EXE and you should see this this display:

Image:Rp_browse_cpx4.png

It is EASIEST to install Digi Realport with your device (or one of the same model) sitting next to you on your local Ethernet. This way the setup program should find it by browsing, plus learn all of the correct capabilities automatically - once installed, it is easy to change the IP address if your device is remotely located over wide-area-network such as cellular. In the example above, we'll be enabling Realport to a Digi ConnectPort X4 gateway. If you don't see your product listed, it might not have a proper IP address configured or your Windows firewall is blocking the UDP multi-cast being used. Always temporarily disable your Windows firewall when looking for LOST Digi devices, since they will reply to the Wizard with unreachable or even NULL (0.0.0.0) IP addresses and firewalls will always discard such 'mal-formed' UDP packets.

When you see this display, then:

  • Select the device to configure
  • Press Next>

You should the see this display, where you can configure the basic features to use:

Image:Rp_describe_cpx4.png

  • Change the Default Network Profile to UDP: Serial Data only. This changes Digi Realport to use UDP/IP instead of TCP/IP, plus the Serial Data only warning means all control signals, the ability to change baud rate (etc) is lost in this mode. Digi Realport in UDP mode literally mimics a 3-wire RS-232 line with only Txd, Rxd and signal ground lines.
  • Set the appropriate UDP port number to target as destination - the default of 2101 is likely okay.
  • Tweak other settings as desired. In this display we are configuring COM2 - you could move this to COM6 or other values. Also, with Realport in UDP mode things like Encryption and Authentication are NOT usable, even if the device supports it.
  • Then press Finish

You should see the setup now do some work, run through a few progress displays and finally show this display:

Image:Rp_finish_cpx4.png

At this point, the computer will send any serial data written by a Windows application to COM2 to the IP address 192.168.195.14 in UDP packets to port 2101.

Changing Settings within Realport in UDP mode

After you've installed Digi Realport, you can change setting through the Device Manager. You can open it several ways:

  • Right click My Computer, click Manage, Click Device Manager
  • Open System Properties, click the Hardware Tab, click the Device Manager

Image:Rp_dev_man.png


The Digi Realport device installs itself as a Multi-Port Adapter, right click it and select Properties. You will see this display:

Image:Rp_device_dialog.png


Select the Advanced Tab, and select the Properties button. You will notice the Connection status is Disconnected - this is true since this is UDP/IP, not TCP/IP.

To Change the IP address

Select your Device (in this case ConnectPort X4) in the left panel and not the Port, then select the Network tab. Here you can select to use and change an IP address, or you can change to use a DNS Hostname. So while in this case the device was installed locally with a non-routing IP of 192.168.195.14, you could change it here to be the actual public IP such as 166.x.x.x. Remember to hit Apply when done.

Image:Rp_change_ip.png

To Change the UDP settings

Select the Port 1, then the UDP tab. The COM2 shown here will match the port you installed Realport on. Pressing the HELP button will - surprise - show you some fairly complete help information!

The Local (RX) Port is the UDP source port within UDP packets, while the Device (TX) Port is the UDP destination port. In this example, the two numbers of 2101 match, but they can be any valid port numbers. The default is ideal for Windows-based clients polling the remote Digi product configured in UDP Sockets serial port profile. It sends data from the application to the Digi, and it must return it to the Local (RX) Port number.

If the Digi product is a WANIA, CPX4 or DOIAP with the IA Engine active sending requests to the Windows host, then check the box labeled as Slave/responder mode, which disables the Device (TX) Port. In this mode, Digi realport remembers the UDP source/destination information to send the responses back to the Digi product.

Image:Rp_settings.png

Hit Apply when you are done.

Personal tools
Wiki Editing