General Category > Support Questions

uncatchable System.Net.Sockets.SocketException thrown when trying to read tag

(1/2) > >>

mreighteen:
I'm using the ClxDriver and I create a new connection like this:


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

--- End code ---

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: ---           
_CLXDriver.ConnectionEstablished += OnConnectionEstablished;
_CLXDriver.ComError += OnConnectionLost;
_CLXDriver.ConnectionClosed += OnConnectionClosed;

--- End code ---

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:
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:
The version of the dll is 1.2.5.0 when I look at the properties.

Archie:

--- Quote from: mreighteen on January 25, 2024, 07:47:23 AM ---The version of the dll is 1.2.5.0 when I look at the properties.

--- End quote ---
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:
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!

Navigation

[0] Message Index

[#] Next page

Go to full version