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.
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.
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()
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?
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.
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
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()
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
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...?
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
Hi,
Hi,
Can you add the thread safe feature?
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
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...?