News:

  • July 03, 2026, 02:02:34 PM

Login with username, password and session length

Author Topic: TCP connections to multiple devices  (Read 10746 times)

racrowd

  • Full Member
  • ***
  • Posts: 23
TCP connections to multiple devices
« on: August 21, 2015, 12:08:40 PM »
I have 3 different devices that I'm trying to communicate with.  There are 2 DC power supplies (0-40 VDC for lower range requirements and 0-300 VDC for higher range) and one 8845A Fluke meter.  I have proven that I can communicate to each individually.  What I'm trying to do is ask one of the power supplies to go to a voltage, and then I ask the fluke meter what that voltage actually is, and then I ask the fluke meter what the current is. 

Everything seems to work well individually, but when I put them all together in sequence, I start to have problems with devices not connecting and other devices not closing.  I ask them to close right before opening another to the device, so I know that it is being asked to close.  Maybe all I need is a little more understanding of what happens when closing a connection.  Do I need to add some logic to verify that the device is closed before moving on?  I've read on here before that opening and closing connections can cause some problems, but I don't know what alternative I have.

ADC Product Engineer

  • Hero Member
  • *****
  • Posts: 270
Re: TCP connections to multiple devices
« Reply #1 on: August 21, 2015, 01:10:02 PM »
Are you using MODBUS TCP, EtherNet IP or custom protocol with OPENTCP?

racrowd

  • Full Member
  • ***
  • Posts: 23
Re: TCP connections to multiple devices
« Reply #2 on: August 21, 2015, 02:25:12 PM »
Actually, I think I got everything working like it should be.  I'm going to try it for a while and will report back if I'm still having some problems.  What I did is before writing to the power supplies, I close any other open devices.  Once the other devices are closed, I jump into the next stage which controls connecting to the device I'm currently interested and communicating to that device.

I'm using a custom TCP/IP connection.

If there are any good practices documents on custom TCP protocol, I would appreciate getting a copy of that.

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: TCP connections to multiple devices
« Reply #3 on: August 21, 2015, 02:38:57 PM »
If there are any good practices documents on custom TCP protocol, I would appreciate getting a copy of that.
This website is the documentation.
The best scenario for what you describe, would be to set each of your physical devices to use a different TCP port. You can then set a TCP device in Do-more to connect to each of them. It is kind of like putting in a separate phone line for each physical device, so that they can all talk at once without hanging up (but it does it over one physical Ethernet cable). This will allow you to talk to all of them, and only have to close them when you want to.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

racrowd

  • Full Member
  • ***
  • Posts: 23
Re: TCP connections to multiple devices
« Reply #4 on: August 21, 2015, 04:10:08 PM »
That is what I'm doing, but if I was connected to device "A" and wanted to speak to device "B", do I have to close the TCP connection to device "A" before opening a TCP connection to device "B"?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: TCP connections to multiple devices
« Reply #5 on: August 21, 2015, 04:28:11 PM »
That is what I'm doing, but if I was connected to device "A" and wanted to speak to device "B", do I have to close the TCP connection to device "A" before opening a TCP connection to device "B"?

If you are using the same TCP device for both, yes, but if you create a TCP device per connection, no.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

racrowd

  • Full Member
  • ***
  • Posts: 23
Re: TCP connections to multiple devices
« Reply #6 on: August 25, 2015, 07:20:33 AM »
If you are using the same TCP device for both, yes, but if you create a TCP device per connection, no.

You are correct.  It works perfect.  I've got a lot to learn when it comes to tcp/ip.