I would like to make a Java client, what can ask sensor data over LAN/WLAN from an Arduino. Where can i find an example code or idea how to do it?
I use a Mega with ethernet shield and Android Studio with Java. I can contact the Arduino with any internet browser like Crome and I get answer from my Arduino. I tried many examples codes for HTML GET requests in Java and all are working fine with the internet, but not with my Arduino.
Start with one of the many Arduino web server examples. There is not a reason in the world it should not work, unless you are doing something to break the server code.
Regards,
Ray L.
The Arduino Server is running well. I can request the Arduino from any web browser in my local network using the IP 192.168... and my Arduino sends answer.
My Java app can request servers in the internet using the url "www..."
But if i change the url to "192.168... (my Arduino)" there is no answer from Arduino.
I have no idea why.
chavmey:
I have no idea why.
Well, it seems pretty obvious there is something wrong in your code, either on the Arduino or on whatever device you're running Java on. But, since nobody here has seen a single line of your code, I don't know what you expect anyone here to do...
Regards,
Ray L.