'How to implement trace-routes in Android Studio?

Given the fact that Android doesn't include a trace-route command, how can I implement the network utility within my app? I know a trace-route is just ping until pinging every hop/router on the way - but how can I do this grammatically? I tried searching for libraries on GitHub and Maven repositories but no luck of anything I can use. I don't mind implementing it myself. I hope I don't have to do this from scratch like crafting a packet and using a socket to connect to every router on the way. Another question would be how to obtain the IP of every router to the destination in Java?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source