Closed PhuongNguyenETIT closed 6 years ago
I use the connected URI("ws://192.168.4.1:3232") to the server. But when I use DNS URI("ws://namedns:3232"), I can not connect to the server. Can anyone help me?
What are you trying to do? Are you trying to approach another device over the internet or locally?
If over the internet, make sure you portforward the right ports for the server to listen too and make sure the device your approaching is not blocking anything on that port.
Thank you, 8databit. I'm making a connection from android application to WiFi esp8266 via DNS registered LAN. When I do through IP address then the connection is to WiFi, but when replaced by DNS is not connected to be. `private void ConnectControl(){ URI uri; try { uri = new URI("ws://SmartBox11160899:3232"); } catch (URISyntaxException e) { e.printStackTrace(); return; } client = new WebSocketClient(uri) { @Override public void onOpen(ServerHandshake handshakedata) {
}
@Override
public void onMessage(String message) {
final String payload = message;
runOnUiThread(new Runnable() {
@Override
public void run() {
}
});
}
@Override
public void onClose(int code, String reason, boolean remote) {
}
@Override
public void onError(Exception ex) {
}
};
client.connect();
}`
Have you tried to resolve the dynamic hostname with something like this? https://stackoverflow.com/questions/15788453/resolving-ip-address-of-a-hostname#15788605
I think marci's answer should work. Maybe URI ("ws://") is not hinting to look locally to resolve the name to an IP.
Marci is telling you to parse the domain to an IP first and than use the IP adress to connect.
And it could also be that your system dns lookup server really cannot look up this dynamic hostname (e.g. wrong configuration)
thanks everyone. you know mDNS in esp8266. I tried to connect from app to esp8266 with mDNS registered, but not connected to it
Is this non library related issue solved for you?
No feedback. Closing issue!
Best regards, marci4
Expected Behavior
Current Behavior
Possible Solution
Steps to Reproduce (for bugs)
1. 2. 3. 4.
Debug log (for bugs)
Context
Your Environment