Author Topic: uncatchable System.Net.Sockets.SocketException thrown when trying to read tag  (Read 431 times)

mreighteen

  • Newbie
  • *
  • Posts: 4
    • View Profile
I'm using the ClxDriver and I create a new connection like this:

Code: [Select]
_CLXDriver = new ClxDriver.EthernetIPforCLX
{
CIPConnectionSize = 508,
DisableMultiServiceRequest = false,
DisableSubscriptions = false,
IPAddress = ClientIP,
PollRateOverride = 500,
Port = 44818,
ProcessorSlot = 0,
RoutePath = null,
Timeout = 4000,
UseOmronRead = false
};

I wan't to make a class that automatically connects to the PLC when it is available, keeps retrying to connect when the PLC is not available and publishes an event when the connection changes. I subscribe to the following events:

Code: [Select]
           
_CLXDriver.ConnectionEstablished += OnConnectionEstablished;
_CLXDriver.ComError += OnConnectionLost;
_CLXDriver.ConnectionClosed += OnConnectionClosed;

The problem is that "ConnectionEstablished" does not fire if there is no Read called. So just creating the "ClxDriver.EthernetIPforCLX" object and waiting for "ConnectionEstablished" to fire whenever the PLC is booted up doesn't work since it never fires. If I do a read when the PLC is booted up it does fire, but if I do a read when the PLC is not booted up, an unhandled "System.Net.Sockets.SocketException" is thrown that I cannot catch since it is thrown on a different thread. So how can I know when the PLC is connected and how can I wait indefinately for a PLC to connect to?

Thnx!

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
What version of the ClxDriver are you using? I want to make sure I test in the same version because an un-catchable exception should not be thrown.

mreighteen

  • Newbie
  • *
  • Posts: 4
    • View Profile
The version of the dll is 1.2.5.0 when I look at the properties.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
The version of the dll is 1.2.5.0 when I look at the properties.
That's quite an older version. If you email sales at advancedhmi.com, and give your order number or email in which it was registered, you can get the latest version that won't give an exception.

mreighteen

  • Newbie
  • *
  • Posts: 4
    • View Profile
That's good to know. I will get the latest version and try again. I post here if the new version works for me.

Thank you for the advice!

mreighteen

  • Newbie
  • *
  • Posts: 4
    • View Profile
Hi,

I updated the driver to version 1.3.4.0 however, the unhandled exception still occurs. I've created a minimal working example. What's the best way to send this to you without sharing the dll publicly?

Thanks!

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Send it to the sales at advancedhmi.com email.