Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. Gurux.DLMS.cpp - Problem With Reconnect

Gurux.DLMS.cpp - problem with reconnect

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By Ponder , 7 February, 2017
Forums
Gurux.DLMS

Platform - Linux 64b Fedora 21
I try co compile GuruxDLMSClientExample (version from github 16.01.2017)
It works nearly ok with my Landis&Gyr counter, (ReadRowsByRange get nothing)
but when I create loop to read another one set of register with new connection
(after about 2 minutes) I receive information :
AARQRequest failed 273.
InitializeConnection failed Rejected permament..

Today I try latest version of library - this error
was now at start. Something was changed in AARQ
and library not working at all.

Edit:
Test on DLMSDirector show the same problem.
First connection works ok , but when I disconnect
and then connect again - connection fail.
I can connect again only when I close program,
and start it again after a few minutes after fail.
If I close program without second try, connection
works immediate.

Profile picture for user Kurumi

Kurumi

9 years 4 months ago

Gurux.DLMS.cpp - problem with reconnect

Hi,

Are you using TCP/IP or serial port connection? I just tested with GXDLMSDirector using TCP/IP connection about 10 times using L+G 650 and there was no problems. Can you connect and reconnect with GXDLMSDirector and send trace to me by email? You can get trace under Tools menu.

BR,

Mikko

Profile picture for user Kurumi

Kurumi

9 years 4 months ago

Gurux.DLMS.cpp - problem with reconnect

Hi,

There must be delay between connections. If you try to connect right away you get error. Wat 30 seconds between connections.

BR,

Mikko

Ponder

9 years 4 months ago

In reply to Gurux.DLMS.cpp - problem with reconnect by Kurumi

I found workaround

When I drop and recreate object CGXDLMSClient connection works immediate - less then 1 second after close.
When I use old object - System give me connection error after 15 minutes!.
New library not connect at all.
I try to connect to ZMD310 and old library works (with exception explained before).
And GXDLMSDirector not connect to the same counter even next day.
When I close and reopen application - everything works nearly ok (sometimes I must
close application and wait no more then 5 minutes before next try).
I create connection by TCP to box connected to serial port (RS232) on CU-B4+ connected to ZMD.

Ponder

9 years 4 months ago

In reply to Gurux.DLMS.cpp - problem with reconnect by Kurumi

log

Log was sended to e-mail as explained on page and to Gurux2017@gurux.fi

Profile picture for user Kurumi

Kurumi

9 years 4 months ago

Gurux.DLMS.cpp

Hi,

This is interesting. When connection is made first time maximum PDU size is used (0xFFFF) and it works.
When connection is made second time, previous connection PDU size is used (2400, 0x0960).
For some reason your meter is not accept it. It says that PDU size is too small. And your meter returns this value. Anyway, MaxPduSize is set to 0xFFFF when DisconnectRequest is generated.

We have made change for ANSI C, ANSI C++, Java and C# versions.

New version is available on Github. New version from GXDLMSDirector is released today.

BR,

Mikko

Ponder

9 years 4 months ago

In reply to Gurux.DLMS.cpp by Kurumi

Gurux.DLMS.cpp

For me library is now broken.
When I try to connect it gave me:
InitializeConnection
<- 13:12:18 7E A0 07 03 21 93 0F 01 7E
-> 13:12:18 7E A0 1E 21 03 73 C3 7A 81 80 12 05 01 80 06 01 3E 07 04 00 00 00 01 08 04 00 00 00 01 07 22 7E
<- 13:12:18 7E A0 2B 03 21 10 FB AF E6 E6 00 60 1D A1 09 06 07 60 85 74 05 08 01 02 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 00 00 FF FF 06 4E 7E
-> 13:12:19 7E A0 37 21 03 30 6C 7C E6 E7 00 61 28 A1 09 06 07 60 85 74 05 08 01 02 A2 03 02 01 01 A3 05 A1 03 02 01 01 BE 0F 04 0D 08 00 06 5F 1F 04 00 18 02 20 09 60 FA 00 13 F6 7E
AARQRequest failed 273.
InitializeConnection failed Rejected permament..

Old version works after about 5 minutes after this crash.
Can you gave me access to ANSI C version ?
I originaly write AMR programs in C on small ARM
computers under linux, and all read in IEC, but now
I have counter ZMQ to read , and I can't read profile thru IEC
(ZMD I can). I test your library, and it can read with exception
"readrowsbyrange" (by entry works). Many years I read and write C programs, but
not C++. Until now I can't access to COSEM objects of profile directly.
On C I think I can not only use, but test and debug library.

Profile picture for user Kurumi

Kurumi

9 years 4 months ago

Gurux.DLMS.cpp

Hi,

We have tested with C++ version and it works without problems. Are you sure that you have not changed anything?

BR,

Mikko

Ponder

9 years 4 months ago

In reply to Gurux.DLMS.cpp by Kurumi

tests

I only change connection parameters of example.
But during route to home I remaind that github is not only
storage, but also version control system.
At monday I try to test what in (I think) DLMSClient
broke connection possibility to ZMD (and ZMQ).
At home I look at patch/diff and now I know what was changed
at Feb 3rd. This commit broke connection in my work.
It would be earlier, but when I go out from work , I shutdown
serwers for weekend. After weekend I wrote, what I found.
Edit:
Small sugestion - to get profile of last day get date/time
from counter.It is possible that clock in counter is not
correctly set, and last day is not today. (In ZMQ I had
year 2000)

Profile picture for user Kurumi

Kurumi

9 years 4 months ago

Hi,

Hi,

I change example so last date is read. Some meters return error If there is no data between start and end time . I also uncomment Reading multiple scalers with one query. This is causing issues with some meters.

ANSI C version is not open source at the moment.
BR,

Mikko

Ponder

9 years 4 months ago

partially solved

After small testing I found, that AARQ block was changed in conformance field
(in new library sets to 0 (zero) ). When I set it to earlier version( 0x1c0320) program connect
to counter and work . Range reading this time works properly.
Small sugestion:
Between profilebyentry and profilebyrange reading put line:
((CGXDLMSProfileGeneric*) *it)->Reset();

Without in range reading have entry profile as a first line.

Profile picture for user Kurumi

Kurumi

9 years 4 months ago

Gurux.DLMS.cpp

Hi,

Thanks from this info. We'll check this ASAP.

BR,

Mikko

Ponder

9 years 4 months ago

In reply to Gurux.DLMS.cpp by Kurumi

sugestion

Small sugestion:
Between profilebyentry and profilebyrange reading put line:
((CGXDLMSProfileGeneric*) *it)->Reset();

Without in range reading have entry profile as a first line(s).
Edit:
Now it is not working.
I'm testing why.
Edit 2:
It was my testing in old library:
In GXDLMSProfileGeneric.cpp:

void CGXDLMSProfileGeneric::Reset()
{
//TODO:
m_Buffer.erase(m_Buffer.begin(),m_Buffer.end());
}
And reset works (in my testing/opinion) ok.

Profile picture for user Kurumi

Kurumi

9 years 4 months ago

Gurux.DLMS.cpp

Hi,

We fixed Conformance. We also added reset. New version is available on GitHub.

BR,

Mikko

Ponder

9 years 3 months ago

;)

Now everything work for me.

Profile picture for user Kurumi

Kurumi

9 years 3 months ago

Gurux.DLMS.cpp

Hi,

Nice to hear. :-)

BR,

Mikko

Ponder

9 years 3 months ago

Small problem

With 1 counter connected everything works ok , but when I connect second counter
SNRM request get mixed response from 2 counters at the same time.
How I can address 1 counter in SNRM request ? DLMSDirector could,
but for now I'm not found exact metod in C++.

In addition I test DLMSDirector in new wersion.
Connect/disconnect works ok , but not all profiles.
Profile 0.0.98.1.0.255 works ok,
but profiles 1.0.99.98.0.255 and 1.0.99.1.0.255 not working.
When I select it, program communicate something like "Index out of range"
(I see it in polish and it says "Indeks wykraczał poza granice tablicy").
Maybe I must reload something, but I dont know what.
Connections was made new, and data was taken directly from
connected counters.

Profile picture for user Kurumi

Kurumi

9 years 3 months ago

Small problem

Hi,

You need to use meter's serial number as server address. There is example in GuruxDLMSClientExample. Something like this:
CGXDLMSClient cl(true, 0x10, CGXDLMSClient::GetServerAddress([Serial number]), DLMS_AUTHENTICATION_NONE, NULL);

Are there columns on 1.0.99.98.0.255 and 1.0.99.1.0.255?
BR,
Mikko

Ponder

9 years 3 months ago

In reply to Small problem by Kurumi

Hi

Yes, profile have columns.
C++ and older versions of Director shows everything ok.
In your example was 1 mistake
0x10 or 16 , not 0x16.
If found it and now everithing working again.
Thanks for helping.
If you have any questions about Director with my counters
write in this thread , or email me direct.
Thanks again

Profile picture for user Kurumi

Kurumi

9 years 3 months ago

Small problem

Hi,

I have updated example.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin