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.
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.
Hi Kurumi,
We are trying to read data from a Landis+Gyr E350 using DLMS over GPRS, reading by a cloud server running Java.
The server (meter) successfully initiates the connection with the client (Java server). However, when the client tried to read data from the server, a "Failed to received reply from the media" error is received
*** Java code ***
public static void main(String[] args) throws Exception {
GXNet server = new GXNet(NetworkType.TCP, 8221);
GXListener listener = new GXListener();
server.addListener(listener);
server.open();
}
//implement listener class
public static class GXListener extends Thread implements IGXMediaListener, IGXNetListener {
@Override
public void onClientConnected(Object sender, ConnectionEventArgs e) {
System.out.println(String.format("Client '%1$s' is connected.", e.getInfo()));
System.out.println("Time:" + LocalDateTime.now());
GXNet server = (GXNet) sender;
try {
try (GXNet cl = server.attach(e.getInfo())) {
ReadMeter(cl);
}
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
@Override
public void onError(Object o, Exception e) {
return;
}
@Override
public void onReceived(Object sender, ReceiveEventArgs e) {
return;
}
@Override
public void onTrace(Object o, TraceEventArgs args) {
return;
}
@Override
public void onPropertyChanged(Object o, PropertyChangedEventArgs args) {
return;
}
@Override
public void onClientDisconnected(Object o, ConnectionEventArgs args) {
return;
}
private void ReadMeter(GXNet media) throws Exception {
GXDLMSSecureClient client = new GXDLMSSecureClient(true, 16, 1, Authentication.NONE, "12345678", gurux.dlms.enums.InterfaceType.HDLC);
gurux.dlms.client.GXDLMSReader reader = null;
try
{
reader = new gurux.dlms.client.GXDLMSReader(client, media, TraceLevel.VERBOSE, true, null);
media.open();
reader.readAll();
//Create own thread for each meter if you are handling multiple meters simultaneously.
//new Thread(new ThreadStart(reader.ReadAll));
reader.getReadOut();
} catch (Exception e) {
e.printStackTrace();
} finally
{
if (reader != null)
{
reader.close();
}
}
}
*** Log Trace ***
Client '/176.12.156.93:53781' is connected.
Time:2020-02-24T14:15:07.551288600
Authentication: None
ClientAddress: 0x10
ServerAddress: 0x1
TX: 14:15:09.772 2F 3F 21 0D 0A
DisconnectRequest
java.lang.Exception: Failed to received reply from the media.
at gurux.dlms.client.GXDLMSReader.initializeOpticalHead(GXDLMSReader.java:458)
at gurux.dlms.client.GXDLMSReader.initializeConnection(GXDLMSReader.java:565)
at gurux.dlms.client.GXDLMSReader.readAll(GXDLMSReader.java:990)
at Main$GXListener.ReadMeter(Main.java:134)
at Main$GXListener.onClientConnected(Main.java:55)
at gurux.net.GXNet.notifyClientConnected(GXNet.java:304)
at gurux.net.ListenerThread.run(ListenerThread.java:105)
As instructed on a separate topic in this forum, we wanted to validated Password, Server Address, Client Address or Use Logical name referencing. However, we couldn't find the relevant configuration on the meter.
Any assistance is appreciated.
Thank you,
Ohadi
Hi Ohadi,
Hi Ohadi,
Meters are working very differently with auto-connection. Are you using a serial port connection?
Try to remove initializeOpticalHead method. Now you are sending "/?!\r\n" and it's not needed.
BR,
Mikko
Hi Kurumi,
Hi Kurumi,
Thank you for the reply.
We are trying to connect using GPRS, not a direct serial connection.
I tried removing initializeOpticalHead method (from GXDLMSReader.java). Behavior is still the same:
Client '/176.12.221.129:59182' is connected.
Time:2020-02-26T15:36:49.318899200
Authentication: None
ClientAddress: 0x10
ServerAddress: 0x1
TX: 15:36:49.318 2F 3F 21 0D 0A
java.lang.Exception: Failed to received reply from the media.
at gurux.dlms.client.GXDLMSReader.initializeOpticalHead(GXDLMSReader.java:458)
at gurux.dlms.client.GXDLMSReader.initializeConnection(GXDLMSReader.java:565)
at gurux.dlms.client.GXDLMSReader.readAll(GXDLMSReader.java:990)
at Main$GXListener.ReadMeter(Main.java:134)
at Main$GXListener.onClientConnected(Main.java:55)
at gurux.net.GXNet.notifyClientConnected(GXNet.java:304)
at gurux.net.ListenerThread.run(ListenerThread.java:105)
Please advice how to procceed.
Thank you,
Ohadi
Hi Ohadi,
Hi Ohadi,
You are still sending "/?!\r\n". Meter is not replying for that. You need to skip it.
BR,
Mikko
Hi Gurux,
Hi Gurux,
I removed "initializeOpticalHead" method that sends "/?!\r\n", as you can see in the console output below. Still, I receive the same error.
Client '/127.0.0.1:57698' is connected.
Time:2020-02-27T09:23:13.102879500
Authentication: None
ClientAddress: 0x10
ServerAddress: 0x1
TX: 09:23:13.102 7E A0 07 03 21 93 0F 01 7E
java.lang.RuntimeException: Failed to receive reply from the device in given time.
at gurux.dlms.client.GXDLMSReader.readDLMSPacket(GXDLMSReader.java:282)
at gurux.dlms.client.GXDLMSReader.initializeConnection(GXDLMSReader.java:569)
at gurux.dlms.client.GXDLMSReader.readAll(GXDLMSReader.java:990)
at Main$GXListener.ReadMeter(Main.java:134)
at Main$GXListener.onClientConnected(Main.java:55)
at gurux.net.GXNet.notifyClientConnected(GXNet.java:304)
at gurux.net.ListenerThread.run(ListenerThread.java:105)
Data send failed. Try to resend 1/3
TX: 09:24:13.148 7E A0 07 03 21 93 0F 01 7E
Data send failed. Try to resend 2/3
TX: 09:25:13.177 7E A0 07 03 21 93 0F 01 7E
Data send failed. Try to resend 3/3
TX: 09:26:13.196 7E A0 07 03 21 93 0F 01 7E
DisconnectRequest
Thank you,
Ohadi
Hi,
Hi,
Can you connect to the meter with GXDLMSDirector? Check what is an interface type. Now it's HDLC, but you might need to change it to the WRAPPER.
BR,
Mikko
Hi,
Hi,
1) I changed the interface type in my Java code to WRAPPER. Still, the same response.
2) I installed and set up the Director. However, the meter is currently the one that initiates the connection (I think it is called "push listener"). I can't find this function in the Director.
Thanks,
Ohadi
Time:2020-02-27T11:43:27
Time:2020-02-27T11:43:27.087748600
Authentication: Low
ClientAddress: 0x10
ServerAddress: 0x1
TX: 11:43:27.087 00 01 00 10 00 01 00 30 60 2E A1 09 06 07 60 85 74 05 08 01 02 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 02 80 00 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 1C 03 20 FF FF
java.lang.RuntimeException: Failed to receive reply from the device in given time.
at gurux.dlms.client.GXDLMSReader.readDLMSPacket(GXDLMSReader.java:282)
at gurux.dlms.client.GXDLMSReader.readDataBlock(GXDLMSReader.java:363)
at gurux.dlms.client.GXDLMSReader.readDataBlock(GXDLMSReader.java:349)
at gurux.dlms.client.GXDLMSReader.initializeConnection(GXDLMSReader.java:581)
at gurux.dlms.client.GXDLMSReader.readAll(GXDLMSReader.java:991)
at Main$GXListener.ReadMeter(Main.java:134)
at Main$GXListener.onClientConnected(Main.java:55)
at gurux.net.GXNet.notifyClientConnected(GXNet.java:304)
at gurux.net.ListenerThread.run(ListenerThread.java:105)
Data send failed. Try to resend 1/3
TX: 11:44:27.128 00 01 00 10 00 01 00 30 60 2E A1 09 06 07 60 85 74 05 08 01 02 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 02 80 00 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 1C 03 20 FF FF
Data send failed. Try to resend 2/3
TX: 11:45:27.159 00 01 00 10 00 01 00 30 60 2E A1 09 06 07 60 85 74 05 08 01 02 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 02 80 00 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 1C 03 20 FF FF
Data send failed. Try to resend 3/3
TX: 11:46:27.188 00 01 00 10 00 01 00 30 60 2E A1 09 06 07 60 85 74 05 08 01 02 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 02 80 00 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 1C 03 20 FF FF
DisconnectRequest
Hi Ohadi,
Hi Ohadi,
Push listener waits for push messages (Notifications) from the meter. I believe that you want to listen that meter makes the connection and then read some data from the meter. This is called an auto connection.
What is the module that you are using on the meter? You should be able to make the connection using GXDLMSDirector if you know the IP address of the meter.
BR,
Mikko
Hi Kurumi,
Hi Kurumi,
We are using E350 by Landis Gyr
Communication module - E35C
Currently trying to connect with GXDLMSDirector. Currently, no luck.
Any other methods in which I can "debug" my issue?
Thank you,
When I try to connect using
We cannot connect with GXDLMSDirector. Please see attachment.
How can I debug why is the connection failing?
Hi,
Hi,
I can't see your image. It's compressed to 600*400 and text is unclear. One of your settings is wrong.
Is that TCP/IP error or DLMS error?
BR,
Mikko
Hi,
Hi,
The text of the error is:
A connection attempt failed because the connected party did not properly respond after a period of time...
It is hard for me to tell if this is a TCP/IP error or DLMS error.
I re-captured all of the settings. I hope these screenshots are clearer.
Thanks,
Ohadi
Another screenshot
Another screenshot
Secured screenshot
Secured screenshot
Supported devices screenshot
Supported devices screenshot
Settings screenshot
Settings screenshot
Hi,
Hi,
This is TCP/IP error. Your IP address or port number is wrong.
BR,
Mikko
Hi,
Hi,
How can I set up the correct TCP port on the meter?
Currently, I have a scheduled an auto connection every 5 minutes (over GPRS). Looking in Wireshark sniffer, I see that the TCP changes every few hours, but the port changes with every connection attemp.
I also tried port 8221
I also tried the latest port when the device tried to connect to the server (55330)
How can I set the correct port?
Thanks,
Ohadi
Hi,
Hi,
You should read this:
http://www.gurux.fi/Gurux.DLMS.DynamicIP
You can't connect to your meter if you are using a dynamic IP address.
The meter must always start the connection.
BR,
Mikko
Can I use director on a
Can I use director on a dynamic IP?
If not, what other method do I have to debug my connection issue?
Hi,
Hi,
You can't use GXDLMSDirector with dynamic IPs because we don't know connecting meter, etc.
One of your connection settings is wrong.
Try to change client address from 16 to 1 and change authentication from Low to None.
BR,
Mikko
Hi,
Hi,
I am changing the connection setting on my server code (GXListener) to client address 1, no authentication. Still the same message:
Client '/176.12.198.197:35842' is connected.
Time:2020-03-04T11:35:04.060631200
Authentication: None
ClientAddress: 0x1
ServerAddress: 0x1
TX: 11:35:04.496 00 01 00 01 00 01 00 1F 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 00 1E 1D FF FF
Data send failed. Try to resend 1/3
TX: 11:36:04.529 00 01 00 01 00 01 00 1F 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 00 1E 1D FF FF
1) What should the server address be?
2) Can you please guide me how to validate these settings on the meter itself? The configuration there is unclear to me
Thanks,
Ohadi
Another thing:
Another thing:
According to different server configurations, I see two different error messages:
Failed to received reply from the media.
and
Failed to receive reply from the device in given time.
Hi,
Hi,
Settings are varying between meter manufacturers and meter models.
There is no way to validate settings. You need just know them.
There are usually three settings that must be correct or meter doesn't reply.
1. Is HDLC or WRAPPER used?
2. Server address.
3. Client address.
BR,
Mikko
Hi,
Hi,
I was thinking this. Some meters are sending notify event when they are making connection to the meter.
If you are receiving this I can get correct settings from this message.
Check if you are receiving data to onReceived-method. Post received data here and I'll check it.
BR,
Mikko
Hi,
Hi,
The onReceived method is never invoked.
Only onClientConnected is invoked. These is the data received in onClientConnected as two parameters,
Object sender and ConnectionEventArgs e:
this = {Main$GXListener@886} "Thread[Thread-0,5,main]"
sender = {GXNet@887}
receiveDelay = 0
asyncWaitTime = 0
protocol = {NetworkType@897} "TCP"
hostName = null
port = 8221
server = true
syncBase = {GXSynchronousMediaBase@898}
trace = null
exception = null
receivedBuffer = {byte[1024]@942}
receivedEvent = {AutoResetEvent@943}
sync = {Object@944}
receivedSize = 0
lastPosition = 0
socket = {ServerSocket@899} "ServerSocket[addr=0.0.0.0/0.0.0.0,localport=8221]"
tcpIpClients = {ArrayList@900} size = 1
0 = {Socket@949} "Socket[addr=/109.253.219.198,port=39031,localport=8221]"
bytesSent = 0
synchronous = 0
trace = {TraceLevel@901} "OFF"
maxClientCount = 0
eop = null
configurableSettings = -1
listeners = {ArrayList@902} size = 1
0 = {Main$GXListener@886} "Thread[Thread-0,5,main]"
netListeners = {ArrayList@903} size = 1
receiverThread = null
listenerThread = {ListenerThread@876} "Thread[GXNet ServerSocket[addr=0.0.0.0/0.0.0.0,localport=8221],5,main]"
started = {AutoResetEvent@912}
monitor = {Object@957}
isOpen = false
serverSocket = {ServerSocket@899} "ServerSocket[addr=0.0.0.0/0.0.0.0,localport=8221]"
created = true
bound = true
closed = false
closeLock = {Object@945}
impl = {NioSocketImpl@946} "Socket[addr=0.0.0.0/0.0.0.0,port=0,localport=8221]"
options = null
parentMedia = {GXNet@887}
name = "GXNet ServerSocket[addr=0.0.0.0/0.0.0.0,localport=8221]"
priority = 5
daemon = false
stillborn = false
eetop = 1900568682496
target = null
group = {ThreadGroup@885} "java.lang.ThreadGroup[name=main,maxpri=10]"
contextClassLoader = {ClassLoaders$AppClassLoader@890}
inheritedAccessControlContext = {AccessControlContext@914}
threadLocals = null
inheritableThreadLocals = null
stackSize = 0
tid = 15
threadStatus = 5
parkBlocker = null
blocker = null
blockerLock = {Object@915}
uncaughtExceptionHandler = null
threadLocalRandomSeed = 0
threadLocalRandomProbe = 0
threadLocalRandomSecondarySeed = 0
connectionWaitTime = 0
e = {ConnectionEventArgs@888}
info = "/109.253.219.198:39031"
value = {byte[22]@896}
coder = 0
hash = 0
hashIsZero = false
accept = true