Nothing really "wrong", and in the end icmp4j is able to initialize. Icmp4j by default tries to use the JNI implementation, followed by the JNA implementation. Here is what seems to be happening: 1. icmp4j looks for its native library the path identified by java.library.path 2. It does not find it there, so it logs the warning: loadLibraryNoException (). Native.loadLibrary () failed 3. Then, it looks for it via java resources, meaning on the classpath and inside jars 4. It finds it there, and tells...
Thanks for answer. One Question more: <2021-12-21 21:02:19> <DEBUG> <NativeBridge> <initialize ()> <2021-12-21 21:02:19> <DEBUG> <NativeBridge> <trying delegate UnixJniNativeBridge> <2021-12-21 21:02:19> <INFO> <JniUtil> <loadLibrary trying to load icmp4jJNI from java.library.path> <2021-12-21 21:02:19> <WARN> <JniUtil> <loadLibrary can't load icmp4jJNI from java.library.path exception java.lang.UnsatisfiedLinkError, errorMessage: no icmp4jJNI in java.library.path: [/home/freehawk/java_server/]>...
Assuming you are using the default icmp4j logger, call something like this: import org.icmp4j.logger.PrintStreamLogger; PrintStreamLogger.setLogLevel(PrintStreamLogger.ERROR); You can also completely override the logger with this: import org.icmp4j.logger.Logger; Logger.setLoggerClass(<your class that implements Logger>) This way you could implement an slf4j version, or a log4j version, for example, and route through your own logging system...
Hello, can I deactivate this messages: <2021-12-12 20:50:23> <DEBUG> <JnaUtil> <loadLibrary2 ()> <2021-12-12 20:50:23> <DEBUG> <JnaUtil> < strategy: native via java.library.path> <2021-12-12 20:50:23> <DEBUG> <JnaUtil> < libraryName: icmp> <2021-12-12 20:50:23> <DEBUG> <JnaUtil> < libraryClass: org.icmp4j.platform.windows.jna.IcmpLibrary> <2021-12-12 20:50:23> <DEBUG> <JnaUtil> <loadLibrary2 ()> <2021-12-12 20:50:23> <DEBUG> <JnaUtil> < strategy: native via java.library.path> <2021-12-12 20:50:23>...
yixing1337 - the full native implementation of this is very time consuming and we don't have enough cycles to deal with this now. So we ticketed this internally, and expect to include this with the next set of native changes. If anybody else cares about this, please speak up. Meanwhile, I think that the rttNanos experimental change we pushed with the link above should be a decent starting point. Yes it does include the JNI overhead, but if you are running this on a decently fast machine, the overhead...
If the os does it and uses the right timing function like GetTickCount() and much better, media timers, then it is extremely accurate. I have done enough with this and VOIP apps that need accurate timing that I am confident we can handle ICMP. At the same time, other considerations are how much crap the OS is doing that it shouldn't, OS firewall, AV firewalls, anti-malware interceptions, packet capturing, and fluctuations in the Quartz. But there is nothing we can do about lots of these. Bottom line,...
I guess we can change the native librairies to use struct timespec instead of struct timeval to get nano seconds precision. I am just wondering if the ICMP stack in kernels are that precise !
I guess we can change the natives librairies to use struct timespec instead of struct timeval to get nano seconds precision. I am just wondering if the ICMP stack in kernels are that precise !
By interface I mean the "rttNanos", not the accuracy of the field. Plus we need to think about everybody, not just an individual's use-case. Also, let's be fair to the amount of time added by measuring this on the Java side vs the native side: it varies between operating systems and includes a lot of other "stuff" happening in the middle. In Windows, for example, you should expect a JRE - native switch, then a process-to-OS context switch for privilege escalation, which may be queued on top of it,...
no, the results based on the current solutions are not ideal. Most of the rtt obtained by ping LAN machines will be twice the delay detected by directly using the ping command, and sometimes it will be much higher. So, i think maybe native implementation is the better way to solve this problem. Thank you very much for your enthusiastic answers and help
no, the results based on the current solutions are not ideal. Most of the rtt obtained by ping LAN machines will be twice the delay detected by directly using the ping command, and sometimes it will be much higher. So, native implementation is the better way to solve this problem. Thank you very much for your enthusiastic answers and help
So the interface is OK then? We'll work on the native implementation. I'll see when Laurent is available to help with this and give you an ETA.
Indeed, this solution does add additional time overhead, and will introduce additional deviations in detecting the network status between machines. We are preparing to do network monitoring between machines, so the ping delay is best calculated in native.
Try this: https://we.tl/t-Lwhwe0rNNx And call this to get the rtt in nanoseconds: final long rttNanos = response.getRttNanos (); rttNanos is an experimental feature and currently includes the bridge timing overhead. LMK how it works out for you, and we'll work on pushing the time calc to the native side.
For the reasons you said, using nanoseconds seems to be an easier solution to this problem. I agree with it. When is this problem expected to be fixed?
Got it. On the native side, the timing is a standard timeval struct with tv_secs + tv_usecs. So while converting the data type to a float/double would somewhat solve the problem, it would break the response interface, so it's a no-go. I would expose time as a long value representing either millis, micros, or nanos. Millis doesn't work because on LANs we can get < 1 msec response. Micros feels like a better match, But this being a Java interface, I would choose millis or nanos in order to be compatible...
thanks! I use the implementation class UnixJniNativeBridge in the project。Another suggestion is whether to consider modifying the data type? It may be the data type used is causing this problem
thanks! I use the implementation class UnixJniNativeBridge in the project。Another suggestion is whether to consider modifying the data type? It may be the data type used is causing this problem
When I started this, I settled on millisecond-precision: the microservice precision is just not there. But we can look into adding it... What NativeBridge implementation are you using?
When running icmp4j on Linux, pinging a LAN machine, the round trip delay rtt less than 1 millisecond will be displayed as 0. We guess that the data type of the rtt field in the Icmp4jJNI class is an integer, which causes the data to be rounded. How to deal with it?
Excellent. The build you tested is a full build off the main branch. So I am going to considered this fixed. This fix will be included in the next release, along with credits to you, unless you indicate otherwise. Thanks for your help! Sal.
Hi Sal, Sorry for taking that long to get back to you, I was out of the office for the last few days. I've tested the new version yesterday for about 4 hours non stop, and I got no problems with it. I believe that the issue is solved, as the library would throw an exception in a few seconds after running, on the last version. Thank you very much. Best regards, Darlan.
Thank you Sal. I'm gonna test it and I get back to you in a couple days. Darlan
Darlan, Here is a preview of version 1021: https://wetransfer.com/downloads/bafddbc4f78a47dfb33e9e38b860b69820210214164332/cdcab2b969ffbdaf6fb706ff3939659020210214164347/f011d9 Please let me know if things work or if you run into any other problems. Sal.
Excellent. So this is actually not a timeout. It looks like the ARP tables have an entry for the IP but it is not reachable. Or maybe there are routing rules for it, but the IP is down. All good scenarios to add to icmp4j. I will add it, test it, and send you a patch for you to validate, and then we can release it. Sal.
Here's the output: darlan@darlan-pc ~> ping -c 1 -s 56 -w 1 192.168.32.9 PING 192.168.32.9 (192.168.32.9) 56(84) bytes of data. From 177.84.139.27 icmp_seq=1 Destination Host Unreachable --- 192.168.32.9 ping statistics --- 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms I just changed the end of the IP address cause 192.168.32.16 is replying now in my network, but, for this tests, it's the same behaviour. I've recorded the pings and posted it on youtube, if you want to check...
Understood. Please try to get me the output for your instant timeout on "ping -c 1 -s 56 -w 1 192.168.32.16". Sal.
Hello Sal, Here's the output: darlan@darlan-pc ~> ping -c 1 -s 56 -w 5 www.google.com PING www.google.com (172.217.30.36) 56(84) bytes of data. 64 bytes from gru10s10-in-f4.1e100.net (172.217.30.36): icmp_seq=1 ttl=121 time=17.2 ms --- www.google.com ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 17.298/17.298/17.298/0.000 ms I forgot to mention in my last reply that the problem only occurs on timeouts, it works without any problem when the...
Darian, Please execute this in a terminal and reply with the output: ping -c 1 -s 32 -w 5 www.google.com Also, any chance of knowing what the command line was when this happened? We will look into changing the parse to intercept exceptions and include it so we avoid this in the future. Finally, if you Laurent wrote UnixJniNativeBridge and UnixJnaNativeBridge, which use native libraries instead of spawning a process. Did you try them? Did they not work? Sal.
Hello, I know this is an old thread, but I had this problem in the last few days, and managed to track it down. I'm running Linux Mint 19.3, and LinuxProcessNativeBridge. Sometimes - can't figure out why (maybe multiple requests to the same network, with one of them failing, don't have time to test now) - the ping process takes less time than the timeout to end, and the LinuxProcessNativeBridge.executePingRequest(request) doesn't mark it as a timeout, throwing the exception. I've attached the changes...
Can you post the full OpenBDD output for these commands? 1. ping 192.168.100.43 2. ping 127.0.0.1 3. ping localhost 4. ping www.google.com 5. ping xxxxxxxxxxxxx
Can you post the full OpenBDD output for these commands? 1. ping 192.168.100.43 2. ping 127.0.0.1 3. ping localhost 4. ping www.google.com 5. ping xxxxxxxxxxxxx
Hi, The parameter "stringList" final List<string> stringList = ProcessUtil.executeProcessAndGetOutputAsStringList(command); passed to IcmpPingResponse executePingRequest(final List<string> stringList) {...} may contain empty lines.</string></string> 2.OpenBSD ping may reports: ping: wrote 192.168.100.43 64 chars, ret=-1 ping: sendto: Host is down
Hi, The parameter "stringList" final List<string> stringList = ProcessUtil.executeProcessAndGetOutputAsStringList(command); passed to IcmpPingResponse executePingRequest(final List<string> stringList) {...} may contain empty lines.</string></string> 2.OpenBSD ping reports: ping: wrote 192.168.100.43 64 chars, ret=-1 ping: sendto: Host is down
GG Badoi -eExcellent debug/report. Thank you. The latest version of icmp4j offers several Linux implementations: 1. UnixJnaNativeBridge, which uses JNA in-process 2. UnixJniNativeBridge, which uses JNI in-process 3. LinuxProcessNativeBridge, which spawnn the ping process 4. MacProcessNativeBridge, which spawns the ping process 5. UnixNativeBridge, which delegates to UnixJniNativeBridge (in-process) Can you try #5 and see what you get? As for the bug you just reported, it probably is still there in...
Check, in LinuxNativeBridge.java: final String responseAddress = StringUtil.parseString( string, "from ", " "); final String ttlAsString = StringUtil.parseString( string, "ttl=", " "); On linux (tested on Debian Buster), the response may be: "From nnn.nnn.nnn.nnn icmp_seq=3 Destination Host Unreachable" so both responseAddress and ttlAsString are null. The following final int ttl = Integer.parseInt(ttlAsString); raises NumberFormatException; Same for rttAsString;
Hey Sal, Sorry, I missed your reply. I went on to vacation, then I changed my job. During all this I forgot about icmp4j. :D I have less time nowdays, but I can try to be helpful. I am in +1 timezone offset (Europe/Belgrade). First step is to investigate how other project get released on Maven central. I will make this a task for me for this week.
Oh, I definitely didn't think your post was cranky. Just giving you my honest feedback... The day I will be able to spend more time on this, I will surely be in touch. Thank you Rulasmur!
Apologies for my cranky earlier post, I was pretty tired. I have deleted the repository, as it was really only for testing. I am happy to do the grunt work to move the project over to github + gradle + publishing to maven central. Once setup it would not require much from yourself to publish to maven. Please let me know if you ever do wish to consider this, I willl be happy to help!
I am not ready to deal with any of this yet. Both mavencentral and github have popped up several times. However the reality is that this migration is not simple. At one point, sf.net was the place to be. Then Google code. Then MS. I realize github is probably the winner now, but I just don't have the time to deal with this just yet. As for your version of icmp4j, I ask that you clearly indicate that this is your copy and not the original icmp4j distribution which is reachable only via icmp4j.org....
Hi there, I've created a repository on github for icmp4j: https://github.com/Rulasmur/ICMP4j It is currently under my name for testing purposes, however can easily be moved to an orginization account. I have started the process of converting it to a Gradle project(Its quite like Maven, just much nicer) and its mostly done. I still need to figure out where the native files fit in, but otherwise it passes tests and works quite nicely. Getting icmp4j onto mavenCentral with gradle would not be much of...
I'm game for this. Actually after your post from 2016-02-12, I did spend some time looking into it but, like many things today, seems very complicated. I am interested in posting the primary artifacts as jars, binaries, and bundled source as you said. For now I'm at timezone/offset -08:00. How about you?
Hey guys, Can I help you with the mavenization of the project? I am more than willing to do it. I think you will have many benefits of having the project on a promninent place such is Maven central. Also users who are already using Maven will benefit tremendously by it! Just leave a message :)
Short version No, icmp4j does not run the ping executable by default. Get the latest of icmp4j from sf.net, and see how that works for you. If you still see the same problem, it means that both the icmp4j Linux JNI and JNA bridges are not working, so we can look at it with you. In any case, run a ping command from the command line on your terminal, and post the output here. Long version No. And here are answers to your questions: 1. icmp4j is hosted on sf.net, so use the version from here 2. icmp4j...
Hey guys, I've been talking to laurentbh about this, on his ICMP4j repo. How do you think we can get to the bottom of this? It can't be a JNA issue, as the issue is occuring on a linux machine, therefore ICMP4J is invoking the terminal ping, no? Thanks Joe
Tracking it here: https://github.com/laurentbh/icmp4j/issues/2 Please advise. Thanks
laurent buhler, you right, parsing the output - is bad solution, I'll take your advice,...
Sal, I have tested your new update, and it works in my case, even if doing request.setTimeout...
Sal, I have tested your new update, and it works in my case, even if doing request.setTimeout...
Dmitry, Here are some more changes: http://secure.fileprotocol.com/dl?guid=0F5C2869-F5EF-4714-16DD-A63AAF4DFCCF...
Rather than looking for some strings in the result, you should use the response flags...
I tried to run my another custom ping method and everything fine: // Use this method...
I tried to run my another custom ping method and everething fine: // Use this method...
I tried to run my another custom ping method and everething fine: // Use this method...
Okay, i have dowloaded your attachement and extracted archive. I have linked files...
Okay, i have dowloaded your attachement and extracted archive. I have linked files...
Okay, i have dowloaded your attachement and extracted archive. I have linked files...
Okay, i have dowloaded your attachement and extracted archive. I have linked files...
Dmitry, please try this beta build of 1021: http://secure.fileprotocol.com/dl?guid=932ECC05-9203-E594-00AD-0F9E23D7B0AE...
Sorry it's okay https://yadi.sk/i/NlEepAVS3GQBNQ
Hey Dimitri, Can you get a more precise error message when you do ping -n 1 -l 32...
It's good idea to add the method mentioned above like: request.setSource(sourceIp);...
It's good idea to add the method mentioned above like: request.setSource(sourceIp);...
It's good idea to add the method mentioned above like: request.setSource(sourceIp);...
C:\Users\ADM>ping -n 1 -l 32 -w 1 -S 192.168.0.77 192.168.0.238 Pinging 192.168.0.238...
C:\Users\ADM>ping -n 1 -l 32 -w 1 -S 192.168.0.77 192.168.0.238 Pinging 192.168.0.238...
I may be able to add something like this: request.setSource(sourceIp); Please run...
Thanks for you reply, Sal Ingrilli. Maybe i I spoke too abstractly. Let i explain...
Thanks for you reply, Sal Ingrilli. Maybe i I spoke too abstractly. Let i explain...
ICMP4J has a WindowsProcessNativeBridge that spawsn ping.exe. I can make the changes...
I join to the Thomas question - i need to execute(in windows) command like "ping...
Sham, The icmp4j Windows implementation uses the Windows IcmpSendEcho native API,...
Hey laurent, My requirement is to ping 254 or even more ips simultaneousely, because...
Hey Sham, not that I want to dodge the question :) but are you sure you want to create...
Below is the code I trying to execute ArrayList<String> devices = new ArrayList<String>();...
No, because icmp4j automatically sets the source IP address on the ICMP packet. This...
Hi everyone! Can I using icmp4j change source address to implement "Smurf attack...
Thomas, Icmp4j doesn't have this option! There is a lot of work to do in order to...
Thomas, Which implementation you are using or planning to use ? (JNI/JNA/Java) L...
Hello, I have a multi-homed Linux machine, i.e. a machine that has more than one...
Hello, I have multi-homed Linux machine, i.e. a machine that has more than one connection...
Anusha, it seems that you are a student at a univerisity. If you can confirm that,...
Your threads are blocked, not deadlocked. Blocked means that they will wait to enter...
In the above example though, threads are forever waiting for the WindowsNativeBridge....
icmp4j is thread safe on all platforms, On unix platforms, you can have concurrent...
Yes, and to make sure everybody understands, icmp4j is thread safe on ALL platforms....
icmp4j on *nix platforms is thread safe :)
The WindowsNativeBridge is synchronized, so no matter how many threads you have running,...