the8472/mldht

Android support?

master255 opened this issue · 12 comments

Your library is good and maybe even too good. But it is written in a java language that is only supported since version 8 of Android. There are still a lot of devices in the world with 4.4 Android and 5.0, 6.0 and 7.0, 7.1, what to do with them?
Maybe rewrite your library for a more java supported language?
I think this will only have a negative impact on the readability of the code, not its speed.

Снимок

Any programmer can write only for the latest versions of devices. Real skill - to write a library which all devices support.

@atomashpolskiy What devices will the library be used on? Do you understand that this completely excludes the Android platform?

I do not intend to support java versions older than 8, in fact I am considering to move to 11 for whatever feature I'll add next (at the current development pace that's probably not going to happen soon though).

You can look at older revisions of the library. At some point, many years ago, there was java 6 support.

Other than that you could try forking it and ripping out the problematic constructs. The arrays class that you're seeing in your error already contains a fallback code path which you could make the default instead.

This library targets desktop and server class machines foremost. That it works on newer versions of android at all is a happy coincidence since I am not even testing in such an environment. Mobile also may have its own pitfalls with frequently changing IPs (switching between mobile and wifi) that can impact DHT performance and aren't well-tested. I mean I do support interface changes, but roaming may be more frequent on mobile than I have dealt with before.

Very bad news for billions of devices on Android, Android TV. Okay. Let's keep developing.

I suspected as much, no problem.

@atomashpolskiy and Ttorrent not have DHT support mpetazzoni/ttorrent#83
All very bad...
I will be the pioneer of DHT for Android.

@the8472 Android uses version 8 of Java, but not all patterns are supported. You need to learn this and make a separate branch for Android devices.
For example, Android does not support the Path class. To change it to File I need to rewrite half of the library.
Your library is not used by anyone for this reason. I have 200+ stars on an abandoned project))) and more forks.
Make a separate branch and rewrite your code using Android Studio to check compatibility.

Your initial report was about ancient android versions. Are you saying the library does not work on current ones? If that's the case I would be willing to accept a PR that provides fallbacks (e.g. vja multi release jars), as long as they are not too invasive and don't compromise performance on regular linux builds.

@the8472 , Your library is too big and complex for me to write PR to it. I don't have time for this.
I'm currently writing my library to download torrents for Android.
It's easier for me to write my DHT module than to take yours.
I'm sorry, but I can't help in coding. This is your library and it will be easier for you to correct the necessary classes and patterns.
At this moment, your library can be used in very rare cases.
I will use it as a guide. Thank you.

@the8472 Sorry, I can't use your library, even as a guide. For a few days I've been trying to figure out where to find the formula to calculate the closest Node and I can't. There's a jungle of auxiliary classes and methods everywhere and it's very confusing.
Maybe you are a beginner programmer. You should learn to write code in a more understandable language.
Or if you want speed so much, you should switch to the Assembler language. Nobody will understand you in this way, you will have maximum speed instead.

Later I will write for everyone where to find the DHT library for Android or where to start.

If you have a question or request, please open a new issue.

If you want to philosophize about code and tell other people what to do: I am not interested. Closing as offtopic.