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. How To Interface The Meter(client) and Server(script) Using TCP ?

How to interface the meter(client) and server(script) using TCP ?

By ERAIYARUL K , 16 February, 2024
Forums
Gurux.Net

Hi All,
Now the meter act as client . I need to host server and communicate with meter , when the meter is connected. How to handshake,read and write with device?.Can u help me?

Profile picture for user Kurumi

Kurumi

2 years 5 months ago

Hi, Communication depends is…

Hi,

Communication depends is your meter connecting to the server using auto-connect or sending push messages.

https://www.gurux.fi/Gurux.DLMS.Objects.GXDLMSAutoConnect
https://www.gurux.fi/Gurux.DLMS.Objects.GXDLMSPushSetup

You can use Gurux open-source libraries to handle meter connections or push messages. If you want to know how to implement handshake, etc, DLMS Greeen Book defines that. It's no possible to tell easily.

BR,
Mikko

ERAIYARUL K

2 years 5 months ago

Hi Thanks for reply I…

Hi
Thanks for reply
I complete the below process to connect with client meter and server
1)create the server:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server_socket:
server_socket.bind((HOST, PORT))
2)listen the meter(client)
conn, addr = server_socket.accept()
executor.submit(handle_connection, conn, addr)
3)calling the function and create a client object ,trace and invocationCounter
client = GXDLMSSecureClient(True)
media = conn
reader = GXDLMSReader(client,media,trace,invocationcounter)
reader.initializeConnection()
here i got issue to handshake,read and write with client meter .Media object is issue for me and i can't able to send and receive the data from media object. Can u help me with sample code in python ?

Profile picture for user Kurumi

Kurumi

2 years 5 months ago

Hi, At first, you need to…

Hi,

At first, you need to check that your meter uses auto-connect as I described earlier.
You need to create GXNet media component and use it like this:

media = GXNet(NetworkType.TCP, None, 4000)
media.server = True
client = GXDLMSSecureClient(True)
reader = GXDLMSReader(client,media,trace,invocationcounter)

BR,
Mikko

  • 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

  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
  • Connecting Meter to Agent via serial
  • Reading block profile with Compact array
  • DLMS server - serving multiple similar datasets gathered from multiple meters across distinct logical addresses
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin