News:

  • June 07, 2026, 09:44:42 AM

Login with username, password and session length

Author Topic: Simultaneous TCP client connections to different TCP servers  (Read 12965 times)

mfloresh

  • Newbie
  • *
  • Posts: 8
Simultaneous TCP client connections to different TCP servers
« on: April 03, 2013, 01:43:08 PM »
Hello,

I am trying to use the DoMore for a custom protocol over TCP/IP. The PLC needs to talk to several TCP servers. I can do one connection at a time, using the OPENTCP prior to doing a STREAMOUT and STREAMIN.
Is there a way to perform OPENTCP to all servers only once so that I do not have to open the connection each time?

I could do UDP comms however I need to check if the server is alive prior to sending a message, because if the server is booting up while I send a message, I lock it up. On this note, is there a way to "ping" a device with the DoMore?

Thanks,

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6158
  • Yes Pinky, Do-more will control the world!
Re: Simultaneous TCP client connections to different TCP servers
« Reply #1 on: April 03, 2013, 02:02:10 PM »
No. TCP connections are point to point. This isn't a restriction related to Do-more, it's the nature of TCP connections.

You can, however, create as many TCP connection devices as you like, and can leave them open as long as you like. I would definitely *not* be connecting and disconnecting. Other than a major hit to performance, there are some pretty ugly side-effects related to the allocation of sockets in the TCP/IP stack, that will eventually lead to major drags on the PLC's scan time.
"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

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: Simultaneous TCP client connections to different TCP servers
« Reply #2 on: April 03, 2013, 02:50:38 PM »
No. TCP connections are point to point. This isn't a restriction related to Do-more, it's the nature of TCP connections.

You can, however, create as many TCP connection devices as you like, and can leave them open as long as you like. I would definitely *not* be connecting and disconnecting. Other than a major hit to performance, there are some pretty ugly side-effects related to the allocation of sockets in the TCP/IP stack, that will eventually lead to major drags on the PLC's scan time.

Is this documented anywhere? I have been opening and closing with every transaction...
Circumstances don't determine who we are, they only reveal it.

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

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6158
  • Yes Pinky, Do-more will control the world!
Re: Simultaneous TCP client connections to different TCP servers
« Reply #3 on: April 03, 2013, 02:55:09 PM »
I'm pretty sure that we recommend it that way in the context of Modbus/TCP master comms. I'm not sure that it got documented that way for raw TCP, but it is the same problem.

Regardless, the performance will be far better if you create a dedicated connection device for each server.
« Last Edit: April 03, 2013, 03:12:58 PM by BobO »
"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