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. Having Problem In Connecting Multiple GPRS(TCP/IP) Meters

Having problem in connecting multiple GPRS(TCP/IP) meters

Profile picture for user Nitin Sethi
By Nitin Sethi , 8 March, 2017
Project
Gurux.Net
Status
Closed (works as designed)

I have already open serverSocket using following lines of code:
IGXmedia Media;
synchronized (Media.getSynchronous()) {
s = ((GXNet) Media).receiver.getClient();
}

And we have two meters(TCP/IP) client sockets but at a time only one socket connection thread is getting open.

Priority
Major
Category
Task
Profile picture for user Kurumi

Kurumi

9 years 3 months ago

Having problem in connecting multiple GPRS(TCP/IP) meters

Hi,

Just to make sure. Are you creating side or client size communicating?
Also do not create issue from this. This is Forum topic what you can create here:
http://www.gurux.fi/forum/21

BR,

Mikko

Profile picture for user Nitin Sethi

Nitin Sethi

9 years 3 months ago

Hi,

Hi,

I am creating client side communicating. And sorry for creating issue over here.

Thanks,

Profile picture for user Kurumi

Kurumi

9 years 3 months ago

client side communicating.

Hi,

You must create own instance from GXNet for each connection.
So if you have two conection you have two instances from GXNet.

BR,

Mikko

Profile picture for user Nitin Sethi

Nitin Sethi

9 years 3 months ago

Hi,

Hi,

Can you describe it little bit that how can we create our own instance because i have seen the code of whole GXNet class but i didn't found anything which let me to have new instance every time , after opening the serverSocket from receiveThread only one client socket is getting connected.

Thanks,

Profile picture for user Kurumi

Kurumi

9 years 3 months ago

GXNet

Hi,

GXNet cl1 = new GXNet();
cl1.Open();
GXNet cl2 = new GXNet();
cl2.Open();

BR,

Mikko

Profile picture for user Nitin Sethi

Nitin Sethi

9 years 3 months ago

Hi,

Hi,

Firtsly, my question is how can i open the serversocket connection with using cl1.open()
and cl2.open(). Because I will be using same static ip and port for serversocket.

Secondly, If I did like this then i am getting following error:

GXNet cl1 = new GXNet();
cl1.setPort(5589);
cl1.setHostName("52.xxx.44.xx");
cl1.setProtocol(NetworkType.TCP);
cl1.setServer(true);
cl1.open();

GXNet cl2 = new GXNet();
cl2.setPort(5589);
cl2.setHostName("52.xxx.44.xx");
cl2.setProtocol(NetworkType.TCP);
cl2.setServer(true);
cl2.open();

java.net.BindException: Address already in use: JVM_Bind

Thanks,

Profile picture for user Kurumi

Kurumi

9 years 3 months ago

client side communicating.

Hi,

Previous post you said that you are making client side sunctionality. Do not set
cl2.setServer(true); This will make network conponent act as server.

BR,

Mikko

Profile picture for user Nitin Sethi

Nitin Sethi

9 years 3 months ago

Hi,

Hi,

I think then i wrote it wrong. And my requirement is like i am making a server in which socket server is open for my clients which are meters. As meters will ping my server, I will capture their socket connection. Then I'll read data asynchronously. And Now I am able to capture my clients(meters) connection as a list of client sockets using ListenerThreads. Earlier I was not able to do that because i was using previous version of Gurux APIs in which ListenerThreads class was not available. Now next step is how can i integrate my client socket with GXCommunicate class to read the data. Please let me know about this.

Thanks,

Regards,
Nitin Sethi

Profile picture for user Kurumi

Kurumi

9 years 3 months ago

client side communicating.

Hi,

What protocol you are using? If you are using GPRS you should read this:
Reading meters using GPRS connection
http://www.gurux.fi/DLMSCOSEMFAQ
BR,

Mikko

Profile picture for user Nitin Sethi

Nitin Sethi

9 years 3 months ago

Hi,

Hi,

We are using TCP/IP protocol. And for single meter having dynamic ips with previous version of Gurux net api, I am able to read data asynchronously. But now for multiple meters i am able to capture multiple socket connections but not able to read data. So please tell me about that.

Thanks,

Regards,
Nitin Sethi

Profile picture for user Kurumi

Kurumi

9 years 2 months ago

Having problem in connecting multiple GPRS(TCP/IP) meters

Hi,

We have added example for dynamic IPs. You should read this:
http://www.gurux.fi/Gurux.DLMS.DynamicIP

BR,

Mikko

Profile picture for user Kurumi

Kurumi

9 years 2 months ago

Profile picture for user Nitin Sethi

Nitin Sethi

9 years 2 months ago

Hi,

Hi,

Thanks for the response.
I have gone through the link which you have mentioned above. Actually in that link GXListener.java was used and in my current version i am not able to find this java class, even in new version from github i am not able to find. Can you please let me know about this.

Thanks,

Profile picture for user Kurumi

Kurumi

9 years 2 months ago

GXListener.java

Hi,

I updated GXListener class to the example.

public class GXListener extends Thread implements IGXMediaListener, IGXNetListener {
}

BR,

Mikko

Profile picture for user Nitin Sethi

Nitin Sethi

9 years 2 months ago

Hi,

Hi,

Can you provide me the link.

Thanks,

Profile picture for user Kurumi

Kurumi

9 years 2 months ago

Dynamic IPs

Hi,

http://www.gurux.fi/Gurux.DLMS.DynamicIP
Check Java code.

BR,
Mikko

Profile picture for user Nitin Sethi

Nitin Sethi

9 years 2 months ago

Hi,

Hi,

Yes, I have checked this java code already. But I was asking is it updated with gurux library which is on github?

https://github.com/Gurux/gurux.net.java/tree/master/development/src/mai…
GXDLMSReader is also not there.

Thanks,

Profile picture for user Kurumi

Kurumi

9 years 2 months ago

Dynamic IPs

Hi,

I do not want to add this to the Github because then we are receiving emails that my meter is not answering. We can't do generic example that works with all the meters because I don't know what protocol is used.

BR,

Mikko

Profile picture for user Nitin Sethi

Nitin Sethi

9 years 2 months ago

Hi,

Hi,

ok, no problem. Can you mail me this to my email id, if you have this.
Net
GXDLMSReader

Thanks,

Profile picture for user Nitin Sethi

Nitin Sethi

9 years 1 month ago

Dynamic IPs

Hi Kurumi,

Thanks for your help for mailing those classes, finally we are now able to communicate with multiple meters on gprs mode using TCP protocol.

Thanks,

Regards,
Nitin Sethi

Profile picture for user Kurumi

Kurumi

9 years 1 month ago

Dynamic IPs

Hi Nitin Sethi,

Thanks from let me know this. It's always nice to hear when everything is working. :-)
Happy coding. :-)

BR,

Mikko

Leo De Luca

6 years 1 month ago

Hi Kurumi.

Hi Kurumi.
I need to do the same (to communicate with multiple meters on gprs mode using TCP protocol). Can you explain me what i need and what to do?
Thanks in advance

Leo

Profile picture for user Administrator

Administrator

6 years 1 month ago

Closed topic

Dear Leo,
This is a closed topic. You can create a new question in the Gurux Forum.
www.gurux.gfi/forum

  • 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
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin