Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Reconnecting after server close connecion

More
26 Jun 2017 17:21 #5286 by support
I am glad to hear this :-)

Best regards

Please Log in or Create an account to join the conversation.

More
26 Jun 2017 12:16 #5285 by bmts
I know that i combine LiveMapping with procedural calls (I have no other choice). I have complex node that is sended from PLC to PC as byte-stream.

I use Nodedescriptor attribute that Mapper create in my object.
For example: When I need to write part of this object I use mapper.client.WriteValue(NodeDescriptor, ...).

As you write, i remove code for reconnecting and it WORKS.

Thanks for help

Please Log in or Create an account to join the conversation.

More
23 Jun 2017 11:49 - 26 Jun 2017 13:58 #5283 by support
There is some confusion here - on your side, on my side, or both.

First of all, why are you combining the Live Mapping model with procedural calls (explicit Subscribe-s and Unsubscribe-s)?

And, are you actually using the Live Mapping for anything? (I do not see any such code posted).

I cannot determine what's wrong without knowing what are you actually trying to achieve, but here are some facts worth knowing:

- Reconnections are handled automatically. No code should be needed for that. If you feel that it does not work, or does not work well, then you need to begin explaining the behavior and the needs starting from the state where you have no extra reconnection logic.

- It is certainly incorrect to call UnsubscribeAllMonitoredItems on the client object that is used by the mapper, especially if the mapper is actually in use for something. That would seriously collide with internal operation of the mapper.

Regards
Last edit: 26 Jun 2017 13:58 by support.

Please Log in or Create an account to join the conversation.

More
23 Jun 2017 11:27 #5282 by bmts
Hello
I have a problem with reconnecting. I use in my .Net application construction like this:

ObjectDataPathAsString = "[ObjectsFolder]/" + PlcName + PartialObjectPath; //

OpcUaBrowsePath = OpcLabs.EasyOpc.UA.Navigation.UABrowsePath.Parse(ObjectDataPathAsString, "www.siemens.com/simatic-s7-opcua");

this.OpcMapper.Map(OpcObject, new UAMappingContext()
{
EndpointDescriptor = EndpointDescriptor, // the OPC server

NodeDescriptor = new UANodeDescriptor // complex node
{
BrowsePath = OpcUaBrowsePath
},
MonitoringParameters = this.ReadUpdateTime, // requested sampling interval

});


if (CallBackMethodRef != null)
{
OpcMapper.SubscribeTarget(iSubscribe, this.OpcObject, ObjectDataPathAsString, false);
ObjectChangedHandle = OpcMapper.Client.SubscribeDataChange(EndpointDescriptor, OpcUaBrowsePath, ReadUpdateTime, CallBackMethodRef);
}


After success subscription and any opperation on OPC-UA server side the server close the connection and i get exception:

OPC-UA service result - An error specific to OPC-UA service occurred.
---- SERVICE RESULT ----
StatusCode: {BadSecureChannelClosed} = 0x80860000 (2156265472)
Description: BadSecureChannelClosed
AdditionalInfo: >>> BadSecureChannelClosed
--- at Opc.Ua.Bindings.TcpAsyncOperation`1.End(Int32 timeout)
--- at Opc.Ua.Bindings.TcpClientChannel.EndSendRequest(IAsyncResult result)
--- at Opc.Ua.SessionClient.EndPublish(IAsyncResult result, UInt32& subscriptionId, UInt32Collection& availableSequenceNumbers, Boolean& moreNotifications, NotificationMessage& notificationMessage, StatusCodeCollection& results, DiagnosticInfoCollection& diagnosticInfos)
--- at Opc.Ua.Client.Session.OnPublishComplete(IAsyncResult result)
StatusCode: {BadTcpInternalError} = 0x80820000 (2156003328)
Description: An existing connection was forcibly closed by the remote host
StatusCode: {Bad} = 0x80000000 (2147483648)
Description: An existing connection was forcibly closed by the remote host
AdditionalInfo: >>> An existing connection was forcibly closed by the remote host
--- at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
--- at Opc.Ua.Bindings.TcpMessageSocket.DoReadComplete(IAsyncResult result)
--- at Opc.Ua.Bindings.TcpMessageSocket.OnReadComplete(IAsyncResult result)
---- REMARKS ----
The server may have rejected the connection because it does not trust the client (e.g. certificate problem); check the diagnostics on the server side, if possible.

After this exception is called this Method on Mapper:

this.OpcMapper.Client.UnsubscribeAllMonitoredItems();

and after some time Is aggain called code above (map and subscribe) but it not works.

I Use .NET 4.6.2, Target x64.

What is correct way for recconecting? Or what is Wrong in my code?

Thanks for response.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.066 seconds