logo

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline Vladimir Gonchar  
#1 Posted : Friday, April 10, 2015 7:28:57 AM(UTC)
Vladimir Gonchar

Rank: Member

Joined: 12/1/2014(UTC)
Posts: 19

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
UaClient.isConnected() return true even if UaClient (m_uaConnection) is not ready.

next code is based on your UaClient example and generate an error:

UaClient *client;

void doSomething()
{
// part 1;
if (client==NULL)
{
client = new UaClient("xxx","yyy");
client.connect();
while (!client.isConnected())
{
// waiting until client connects
// relese resourses;

}
}
//part 2;
if (client.isConnected())
client.ReadSomething(); //!!!!!!!!!!!!!! crush;
}

Where is two possible scenario.
1. If client was previously created. Then everything works fine.
2. if software need to create a new client. It crushes.

Am I doing this wrong?

Thank you.

Offline Patrick Griffiths  
#2 Posted : Friday, April 10, 2015 11:12:06 AM(UTC)
Patrick Griffiths

Rank: Advanced Member

Joined: 11/28/2014(UTC)
Posts: 37

Was thanked: 13 time(s) in 11 post(s)
Hi Vladimir,

In general, it's not enough to have a connection. You'll need to create a session before you can read.

Just to make sure we are talking about the same thing: are you trying to re-use the sample code? The sample is intended to be a quick and dirty demonstration of the required workflow, it's probably not a good idea to use it directly as the basis for your own code.

If you can post a more complete code snippet we can give you more specific advice.

Cheers,
Patrick
Offline Vladimir Gonchar  
#3 Posted : Friday, April 10, 2015 12:22:21 PM(UTC)
Vladimir Gonchar

Rank: Member

Joined: 12/1/2014(UTC)
Posts: 19

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
Patrick,
You absolutely right.
I need to wait until session will be created.

Thank you.
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Matrikon Subscribe  |   Matrikon Unsubscribe  |   Global Unsubscribe  |   Privacy Statement  |   Do Not Sell My Personal Information   |   Cookie Notice