Kepware Modbus TCP w serial server


Thread Starter

Jay Banks

I have an issue and I'm sure someone has ran into this before.


B&B ESP901 serial server
Kepware OPC Modbus slave sim
Modbus Test Pro (good Modbus master software)

I set up an old IBM laptop with a Modbus slave simulator configured on it. Seems to work fine.

Using Kepware OPC, I set up two different devices. One TCP and one serial, with the serial using a virtual com port.

On Kepware, the TCP poll fails, but the serial (on the virtual com) works fine. Note, the B&B was configured to have multiple connections, so that isn't the issue.

Using a program called Modbus TestPro, I can poll the laptop using TCP and it also works. BUT, I can only poll it when I select "raw" TCP.

I'm *thinking* that since it works on my secondary program, Kepware may be using normal TCP and the B&B only works with raw TCP packets.

I can't find anything on changing these setting on Kepware or the B&B.

If anyone has ever ran into this, I would be interested in hearing solutions.

Ryan Plester

With MODBUS, there are in general two ways to communicate via TCP/IP. The first (which Kepware seems to be using) is MODBUS TCP. This is basically the regular MODBUS serial protocol with some header information sent via TCP/IP.

The second method is usually referred to as MODBUS RTU via TCP. This is exactly the same as the MODBUS serial protocol except that it is sent via TCP/IP. This protocol does not have the addition header information that MODBUS TCP has. This sounds like the "raw" mode of your other applications.

I am not certain how to set this up in Kepware's OPC sever but the MatrikonOPC server for SCADA MODBUS has this as a selectable option for each MODBUS device that you connect to. Also, the OPC server for MODBUS allows you to specify this by using the Terminal server configuration option.

Feel free to contact MatrikonOPC Support at [email protected] or 780-945-4011

More details can be found on:


I tested the Modbus TestPro with the PeakHMI MODBUS TCP simulator and one other simulator.

I could only run Modbus TestPro in demo mode and the results are the same for both simulator programs.

Both programs received the same request and both responded with the same data and then Modbus TestPro gives an error 'Could not send outgoing packet.' I "assume" that is because it is not registered.

From the help dialog in Modbus TestPro 'raw' means without the TCP wrapper. I do know the PeakHMI simulator and the other one I tested with will not respond to a 'raw' message.

Everest Software also has a MODBUS Master/Slave OPC server (serial and TCP). You might want to give it a try.

I see a guy from Kepware, Fred Loveless (spelling), around here so he might jump in with some help.

Good luck,

Hi Jay,

I am not familiar with the B&B terminal server but the packets used for TCP modbus and serial modbus are different.

You can either use a device like a Lantronix box with Modbus firmware (UDS1100 may have been superceeded now) to do the packet adjustment for you or you can setup a serial Modbus device in Kepware and tick the use Ethernet Encapsulation option. This effectively sends the Modbus packets in Serial format over Raw TCP.

Hope this helps.

Bill Graham
Industrial Thinking Ltd

Fred Loveless

If you set the B&B converter to be a Modbus TCP to Modbus Serial converter then you can us the Modbus TCP driver to talk to the serial devices and the converter will strip the Modbus TCP Header and footer from them message and send a normal serial packet.

If the converter is just configured as a Serial to Ethernet converter then you would use the Modbus Serial driver and select Etherent Encapsulation. This sends a raw Modbus serial packet over Ethernet. Essentially this is what the virtual comm port is doing as well.

If you have any additional questions you can e-mail technical support at Kepware and they can help trouble shoot it more.

Fred Loveless
Applicaitons Manager
Kepware Technologies
I will say that Modbus Test Pro will work just fine unregistered. The only thing it will do is annoy the heck out of you with a pop-up. Which means you must have something set up wrong.

I'm no expert on test software, but Modbus Test Pro is very reasonably priced and one of the best programs I have used. Or at least I can say, it is much better than any free Modbus master I have tried, and much cheaper than most other commercial software I tried...

The modbus serial slave sim, on the other hand, works, but is a little quirky at times. But hey, it's free!
Yes, the Ethernet Encapsulation option worked. I did mess with that yesterday, but I now see I wasn't doing it right.

Am I right in thinking that "virtual" com ports aren't the best way to do things. It seems that in a large setup, you wouldn't want to load a large amount of virtual drivers on a system.

Thanks again!
Thanks for the info.

Can you tell me if you have a preferred method to accomplish this, or does either method work equally well?


Fred Loveless

The advantage to do the protocol conversion (Modbus TCP to Modbus Serial) is that you can have multiple Modbus TCP masters connected to request the same data from the serial device. Straight serial to ethernet conversion allows only one master to be connected and requesting data. Otherwise, there is no real difference in performance.

Fred Loveless
The B&B ESP901 is not Modbus protocol "aware" so it can only pass through a raw serial data stream.

Since it can't strip away the Modbus/TCP header, those extra bytes will confuse the RTU that it is passing the data packets to, which is why only the raw mode worked.

More expensive Modbus protocol-aware serial servers from B&B and other vendors will do what Fred says and can strip away the Modbus/TCP header before the packet reaches the RTU. However as you found, that extra complexity isn't needed if you use the raw mode of your master device or software.

There are many different types of servers out there, some with more intelligence and filtering features than others so it pays to read the manual carefully in order to decipher what the capabilities and limitations are for a specific device.

The B&B ESP901 manual can be found here: 0508m.pdf

I hope that helps.