• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calulate net speed through applet

 
Sid Scud
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to display the Internet speed in an applet. I tried using ping but its waste as ICMP is not supported by java, so how do I calculate the net speed in the applet???
Thank you in advance.
-Sid
 
Cundra Mundra
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure what is possible but you know that in the bottom windows task bar at the right corner it shows the icon (depends how you have it setup) that by pointing the mouse at does show the connection speed. Can you grab it somehow from the system?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the thing to do would be to mimic what ping is doing... Java supports UDP (java.net.DataGramSocket)... have the applet periodically send out numbered UDP packets then make a program to run on the server to listen for the UDP packets and send messages containing the UDP packet's number back to the applet when it recieves one. The applet will know is any packets are lost ( it will not recieve a response containing the UDP packet number from the server ), and it can use the difference in System.currentTimeMillis() calls to time how long it takes to recieve the reply. (Please don't ask for code to this... it is only a suggestion... )
HTH,
-Nate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic