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. Difference Between Python and C#

Difference between python and C#

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 SgmUsr , 14 January, 2021
Forums
General discussion

Hello to everyone,

I'm using Gurux Python and I'm trying to make the first serial communication only with snrmRequest() and aarqRequest().

With c# I'm setting the public client like this:
this.ClientPublic = new GXDLMSClient();
this.ClientPublic.UseLogicalNameReferencing = true;
this.ClientPublic.InterfaceType = InterfaceType.HDLC;
this.ClientPublic.ClientAddress = 16;
this.ClientPublic.Password = GXCommon.HexToBytes("xxxxx");
this.ClientPublic.Authentication = Authentication.None;
this.ClientPublic.ServerAddress = GXDLMSClient.GetServerAddress(1, 16);
this.ClientPublic.ProposedConformance = Conformance.GeneralProtection | Conformance.Get |
Conformance.Set | Conformance.Action;
this.ClientPublic.CtoSChallenge = GXCommon.HexToBytes("CPLc2s00");
this.ClientPublic.Standard = Standard.Italy;
and the aarqRequest() works;
- 7E A0 08 02 21 21 93 05 D1 7E
- 7E A0 21 21 02 21 73 3F 41 81 80 14 05 02 01 00 06 02 01 00 07 04 00 00 00 01 08 04 00 00 00 01 69 6D 7E
- 7E A0 2C 02 21 21 10 17 2A E6 E6 00 60 1D A1 09 06 07 60 85 74 05 08 01 01 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 40 00 19 04 00 BD BC 7E
- 7E A0 44 21 02 21 30 47 B6 E6 E7 00 61 35 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 A4 0A 04 08 34 35 11 02 10 41 01 03 BE 10 04 0E 08 00 06 5F 1F 04 00 40 00 10 00 E5 00 07 31 ED 7E

I'm trying to configure in the same way the python library but the aarqRequest() doesn't work:
self.clientPublic = GXDLMSClient()
self.clientPublic.clientAddress = 0x10
self.clientPublic.proposedConformance = Conformance.GENERAL_PROTECTION | Conformance.GET | Conformance.SET | Conformance.ACTION
##self.clientPublic.useLogicalNameReferencing = True
self.clientPublic.interfaceType = InterfaceType.HDLC
self.clientPublic.authentication = Authentication.NONE
self.clientPublic.ctoSChallenge = 'xxxxx'
self.clientPublic.password = 'xxxxx'
self.clientPublic.serverAddress = GXDLMSSecureClient.getServerAddress2(1, 16, 0)
self.clientPublic.useLogicalNameReferencing = True

- 7ea0080221219305d17e
- 7ea021210221733f418180140502010006020100070400000001080400000001696d7e
- 7ea02c022121320728e6e600601da109060760857405080101be10040e01000000065f1f0400400019ffff652b7e
- 7ea00821022197e0d17e

What is the difference between these 2 configuration?

Thanks

Profile picture for user Kurumi

Kurumi

5 years 6 months ago

Hi,

Hi,

HDLC sequence number is invalid in AARQ request. It should be 0x10 and it's 0x10 in Python. I just checked your code and it worked like expected. You must modify the source code and for this reason HDLC sequence number is wrong.

BR,
Mikko

SgmUsr

5 years 6 months ago

Hi,

Hi,

I found the problem: I missed resetFrameSequence().

Now it works.

Thanks

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701
  • Thu, 07/23/2026 - 16:19
    gurux.dlms.java 4.0.96
  • Thu, 07/09/2026 - 14:34
    Gurux.DLMS.Python 1.0.201
  • Fri, 06/26/2026 - 16:32
    Gurux.Service 3.0.2606.2601
  • Wed, 06/24/2026 - 08:36
    Gurux.DLMS.Python 1.0.200

New forum topics

  • Possible memory leak in file dlms.c, getCompactArrayItem(), getCompactArrayItem2()
  • Official Gurux.DLMS.Client.Example.Net fails during High GMAC secure association (Invalid PDU), while Gurux Director connects successfully
  • gurux_dlms.GXDateTime.GXDateTime object Error in Python
  • T_APPL_DATA_LN_N1 subtest 3 fails on an LN-only server regardless of the response to a non-existing-object GET
  • Version mismatch between Gurux.DLMS 9.x and Gurux.Common/Gurux.Serial 8.x
More

Who's new

  • CRISTIAN MAXENTI
  • mPDxPIQgXwPXoV…
  • AaronAcecy
  • lin
  • JFaHTYnuOHYICbRfEZ
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin