News:

  • April 18, 2024, 07:16:45 PM

Login with username, password and session length

Author Topic: Winsock stack stability  (Read 8419 times)

CWS

  • Newbie
  • *
  • Posts: 4
Winsock stack stability
« on: January 03, 2011, 02:04:32 PM »

Hello,

I have noticed some instability in the implementation of windows sockets in the past. The problem seems to be that a socket opened and closed many times may eventually end up causing the stack to hang until a reboot occurs.

I have NOT observed this behavior with the EBC. I'm just concerned about the implementation of the DLL.

When exactly is a socket opened and closed with the TCP transport, is it on each HEIOpenDevice and HEICloseDevice call?
If so, is it possible to call HEIOpenDevice once on a network with multiple EBC-100s and maintain a socket connection indefinitely?

Chris

MikeS

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 254
    • Host Engineering, Inc.
Re: Winsock stack stability
« Reply #1 on: January 04, 2011, 11:53:41 AM »
the socket is create and closed in heiopendevice and heiclose device respectively

you can (and should) use heiopendevice for each ebc100 at the top of your program and leave them open for the duration of your application, only calling heiclosdevice when your application closes.

Since the HEI comm is UDP (not TCP) there's technically not a 'connection' to be actively maintained like there would be with Modbus/TCP, so there's no benefit to opening and closing the device connections except at the beginning and end of your application.
« Last Edit: January 05, 2011, 08:33:42 AM by Greg »
Good design costs a lot. Bad design costs even more.

CWS

  • Newbie
  • *
  • Posts: 4
Re: Winsock stack stability
« Reply #2 on: January 06, 2011, 03:20:58 AM »
Can you have multiple EBC-100 'open' at the same time?

That is, I can open 10 devices, use them for duration of the application, then close the 10 devices at application termination, right?

MikeS

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 254
    • Host Engineering, Inc.
Re: Winsock stack stability
« Reply #3 on: February 02, 2012, 09:03:53 AM »
you can most definitely have multiple devices open, it's much faster to open all of the devices, interact with them all as need, and close them when you're done with them. There's no need to incur the extra overhead of the open/close for each device, each time you want to access them.
Good design costs a lot. Bad design costs even more.