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. Unable To Connect To Multiple Meters From Multiple Threads

unable to connect to multiple meters from multiple threads

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 pavith , 26 December, 2022
Forums
Gurux.DLMS

hi,
I was using C guruxClient to read the data from multiple meters with multiple threads. i need to read the 100+ meter at the same time. but i was unable to connect to multiple meter at the same time (unable to initializeConnection).
can someone help me out.

Profile picture for user Kurumi

Kurumi

3 years 5 months ago

Hi,

Hi,

You need to establish your own instance from GXDLMSClient for each connection.
The main reason for this is that there are sequence counters that are modified during the connection.

BR,
Mikko

pavith

3 years 5 months ago

hi,

hi,
im establishing the own instance for each connection. if i add some random delay between each connection it works, but my goal it is read 1000+ connection within few seconds..
here are the function sequence i used for each connection:
con_init()
cl_init()
com_makeConnect()
com_updateInvocationCounter()
con_initializeConnection()
cosem_init()
com_read()
com_readRowsByRange()
obj_toString()
obj_clear()
com_close()
con_close()

Profile picture for user Kurumi

Kurumi

3 years 5 months ago

Hi,

Hi,

I believe that you are using the same buffer in TCP/IP connections or somewhere else. Check that first.
Are you using malloc to make an instance from the connection parameters?

BR,
Mikko

pavith

3 years 5 months ago

Hi,

Hi,
I have different struct(array of struct) for each connection and not using malloc.
Also I have a doubt... Is C guruxdlms client is thread safe...?

Profile picture for user Kurumi

Kurumi

3 years 5 months ago

Hi,

Hi,

No, it's not thread-safe. You need to use your own client for each connection and use it only for one thread.

BR,
Mikko

pavith

3 years 5 months ago

Hi,

Hi,
Can you add the thread safe feature?

Profile picture for user Kurumi

Kurumi

3 years 5 months ago

Hi,

Hi,

No, that is not possible. ANSI C is used with different embedded compilers and adding thread support is not possible.

As I told you before you need to create own client instance for each meter and access that client only from that thread.

BR,
Mikko

pavith

3 years 4 months ago

Hi, I still facing the issue…

Hi,
I still facing the issue, as mentioned I was creating own instance for each thread, and I have added random delay between each thread, few of the meter(simulator) were reporting the error -279( auth failure). If I remove delay between the threads, all the meters were reporting the auth failure error...

Im using the same connection.c and communication.c from the client example. I have modified only the main.c file.. with the sequence mentioned in earlier comment.

Can you support me here...?

  • 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