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.Python Suport For IPv6

Gurux.DLMS.Python suport for IPv6

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 jonasfoyth , 5 February, 2020
Forums
Gurux.DLMS

Hi,

I am using the DLMS/COSEM python library to read data from a meter througth IPv6 address by UDP. However, I get an error: ''[Errno -9] Address family for hostname not supported "

Python library not suport IPv6 througth UDP connection?

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

You are right. Support for IP v6 is now added to Gurux.Net.Pyhon version 1.0.10.
It's on the Github now. Some tests are run and it'll publish to pypi latest tomorrow.

BR,

Mikko

jonasfoyth

6 years 4 months ago

Hello Mikko,

Hello Mikko,

I have ran some tests with the new release and still not working. However, i made some changes in lib and worked:

changes:

def open(self):
"""Opens the connection. Protocol, Port and HostName must be set, before
calling the Open method."""
self.close()
try:
with self.__syncBase.getSync():
self.__syncBase.resetLastPosition()

self.__notifyMediaStateChange(MediaState.OPENING)
if ipaddress.ip_address(self.hostName).version is 4:
if self.protocol == NetworkType.TCP:
self.__socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.__socket.connect((self.__host_name, self.__port))
else:
self.__socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.__socket.connect((self.__host_name, self.__port))
else:
if self.protocol == NetworkType.TCP:
self.__socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM, 0)
self.__socket.connect((self.__host_name, self.__port, 0, 0))
else:
self.__socket = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM, 0)
self.__socket.connect((self.__host_name, self.__port, 0, 0))
self.__notifyMediaStateChange(MediaState.OPEN)
self.__thread = threading.Thread(target=self.__listenerThread)
self.__thread.start()
except Exception as e:
self.close()
raise e

Profile picture for user Kurumi

Kurumi

6 years 3 months ago

Hi,

Hi,

This was improved in version 1.0.10. Are you using that? Your changes are great, but the problem in ipaddress.ip_address is that it's not implemented for Python 2.7 and for this reason we can't use it.

Can you tell what failed so we can try to fix it?

BR,
Mikko

jonasfoyth

6 years 3 months ago

Changes in libs:

Changes in libs:
if self.protocol == NetworkType.TCP:
self.__socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.__socket = socket.socket(GXNet.__getInet(self.__host_name), socket.SOCK_STREAM)
self.__socket.connect((self.__host_name, self.__port))
else:
self.__socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.__socket.connect((GXNet.__getInet(self.__host_name), self.__port)

In the UDP side, it should be:

else:
self.__socket = socket.socket(GXNet.__getInet(self.__host_name), socket.SOCK_DGRAM)
self.__socket.connect((self.__host_name, self.__port))

This is working (:

Profile picture for user Kurumi

Kurumi

6 years 3 months ago

Hi Jonas,

Hi Jonas,

Thank you from this info. :-) This is now fixed this and new version is released.

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