Dual ip address for local server in app

It will be good if we can enter 2 IP addresses at a time for local server in app. So that app first tries to connect Ist IP address and if it unable to connect it with in a time limit, application tries second IP address.
Use: It will be helpful at the time of internet disconnection. Suppose i have local server and i am using dydns to point my local server from internet. At the time of no internet, if i am in my local network, app can connect using second ip which i will set local server ip address allotted from my lan.

1 Like

you can do it with a few lines of code :wink:

1 Like

Using hairpin nat with a mikrotik router to solving you problem.

The OP is talking about the custom server address that’s specified in the app. I don’t think that’s changeable by code.

Pete.

1 Like

I am using two local servers.
I ping them when blynk connection is lost to check which server is down and connect to the other.

My recommendation is, serious overkill for a replacement of re-punching in an address… but i’ve done the same stuff in the past, create your own local dns server.

Assuming your outside address is 99.99.99.99 and your inside address is 192.168.1.99. Get a ddns entry for 99.99.99.99, lets call it ngoyat.no-ip.com.

get your favorite dns server software, load it inside your 192.168.1.0/24 network, point your router to hand out this dns server to clients. Make one static entry called ngoyat.no-ip.com and point it to 192.168.1.99.

Change your blynk server in the app to point to ngoyat.no-ip.com. Now when you are outside, it will hit your outside network interface, and when you are inside, it will hit your inside interface.

2 Likes

You are right.
You have to change the IP on the app.
:wink:

1 Like

Exactly what i am saying that if i can enter two ip in app at a time and app tries to connects ist ip and if it fails like in 10-15 seconds, than tries second ip

I am using no-ip and connects local server using it but sometimes internet goes down and i am at home, at that time i have to manually change ip address of my server from no ip dns to local address assigned my router