I am able to receive Heartbeat, push data . Also able to read meter by attaching to the GXNet.
But the problem is when I am making a separate thread for reading the meter, meter connection getting lost. I have tried so many ways to fix this problem. Still not able resolve. I have given the sample coding part below.
@Override
public void onClientConnected(Object sender, ConnectionEventArgs e) {
System.out.println(String.format("Client '%1$s' is connected.", e.getInfo()));
GXNet server = (GXNet) sender;
try {
try (GXNet cl = server.attach(e.getInfo())) {
readMeter(cl);//THIS WILL WORK. Its not a thread
// new ReadMeter(cl).start(); This will disconnect the meter from the server.
}
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
Hi,
I got it what you said. Thanks for the clarity.
But my doubt is how I can read multiple meter connections same time if I hold this connection?
How I can do on Demand request to read a meter with this logic ?
Hi,
We are using TCP. The point you said I have understood. My problem is technical.
As per your documentation I have created the below Listener.
public static class ServerListner implements IGXMediaListener, IGXNetListener {
My doubt is, if 100 meter connects in the same time to our server, will it create 100 instance of above Listener?
If I hold the one meter connection for onDemand, all other 99 meter will be accepted by the server in the same time?
Currently I have only one meter for testing. So practically couldn't check.
Thank you very much Mikko..
I will keep this in mind and continue with other works.
I have one more very small doubt(Please don't tell me to create new topic).
In dynamic IP meter can we set different push server address into meter?(Currently heartbeat and push receiving in same server)
Hi,
Hi,
You will release the connection right away.
You need to move this inside of the thread:
try (GXNet cl = server.attach(e.getInfo())) {
}
Now connection is released when you leave the function.
BR,
Mikko
Hi,
Hi,
I got it what you said. Thanks for the clarity.
But my doubt is how I can read multiple meter connections same time if I hold this connection?
How I can do on Demand request to read a meter with this logic ?
Hi,
Hi,
Each incoming connection has own TCP/IP port. Or are you using UDP?
BR,
Mikko
Hi,
Hi,
We are using TCP. The point you said I have understood. My problem is technical.
As per your documentation I have created the below Listener.
public static class ServerListner implements IGXMediaListener, IGXNetListener {
My doubt is, if 100 meter connects in the same time to our server, will it create 100 instance of above Listener?
If I hold the one meter connection for onDemand, all other 99 meter will be accepted by the server in the same time?
Currently I have only one meter for testing. So practically couldn't check.
Hi,
Hi,
It will create 100 instances from this. There are no delays.
BR,
Mikko
Thank you very much Mikko..
Thank you very much Mikko..
I will keep this in mind and continue with other works.
I have one more very small doubt(Please don't tell me to create new topic).
In dynamic IP meter can we set different push server address into meter?(Currently heartbeat and push receiving in same server)
Hi,
Hi,
It depends on the meter, but usually, you can. Try to change the destination attribute from Push setup and see what happens.
BR,
Mikko