BGS5 as a server | Thales IoT Developer Community
December 3, 2014 - 11:23am, 3348 views
Hi,
I'm trying to listen to incomming TCP connections on BGS5 module using ServerSocketConnection class, and following connection string:
connection_string = "socket://:1111;bearer_type=gprs;access_point=someapn;timeout=null;username=un;password=pwd"
and then openning connection with
Connector.open(connection_string);
connection seems to be established as expected, but when I get local IP (conneciton.getLocalAddress()) it returns me some 10.122. .. kind of address, some random/internal IP which is invalid. The connection to the net using the same sim with regular mobile phone results in completelly different scope of address (which can be validated using f.e. https://ipinfo.io/)
Any ideas what's wrong here?
I managed to establish HTTP server on BGS5t with SIM card that has local network ip of the company. So I can connect to this server if I am inside companys network. But if I use public IP, I can't connect since mobile provider probably blocks port 80.
Hi,
The internet website you are using provides you probably the public address of your provider's network gateway to the internet.
But when your device connects to the network it is assigned an address from the private pool which is not visible outside of your provider's subnetwork.
Usually it is needed to buy an additional service from the network provider to get the public and static IP address.
When your device is using the regular APN it most probably gets only private IP address which is dynamically changed each time the device is attached to the network.
Best regards,
Bartłomiej
In terms of stability on a system that has to work 24/7 with some programmed reset (which changes the IP) do you think that it is preferred to buy the static IP service?
Hello,
I think that it depends on your solution if you need a static IP or not. If you don't have the static IP the address may probably change even if you don't restart your device or connection. It depends on the network which can also detach your device in case of it's idle for some time and generally you have no guarantee that thie IP won't be changed. So if discovering the IP change and notifying the other parties about it is not a problem and your network provider does not block the incoming traffic if you don't buy the static IP it 's up to you.
Regards,
Bartłomiej
Here is example for the server : http://www.blogelectronica.com/en/webserver-java-tc65-mtx65/#comments
But like Bartłomiej said, just have to have right IP.