Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

J2ME ICMP

Posted on 2004-08-19
31
Medium Priority
?
816 Views
Last Modified: 2013-11-23
Hi,

does anyone know or have the code how to realize a Standard Ping to a webserver using J2ME and get delay times, etc.?
0
Comment
Question by:muaddib33
  • 14
  • 8
  • 4
  • +1
31 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 11839320
Short answer, you can't...  MIDP only supports HTTP connections, not ICMP
0
 
LVL 35

Assisted Solution

by:TimYates
TimYates earned 510 total points
ID: 11839337
Long answer, you can do something like this:

http://java.sun.com/developer/J2METechTips/2001/tt0529.html

and send "ping" your servlet on your webapp, which will return "pong", and you can work out how long it took with System.currentTimeMillis() ;

:-)
0
 
LVL 35

Expert Comment

by:girionis
ID: 11839410
You can't even do a pure ping in standard or enterprise java.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 35

Expert Comment

by:TimYates
ID: 11839440
I know...  I'm not sure why it's never been added :-(
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11839452
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11839459
Ooops...

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4727550

it's partially in...  looks like you can ping in 1.5, but not do raw socket access (yet)
0
 
LVL 35

Expert Comment

by:girionis
ID: 11839499
Nice one, so they are going to (or have already done so) implement "ping" and advanced and raw socket support :)
0
 
LVL 35

Expert Comment

by:girionis
ID: 11839510
> but not do raw socket access (yet)

Yes true, although the state is in progress so soon (hopefully) we might have that too :)
0
 

Author Comment

by:muaddib33
ID: 11839525
Hmm...but there must be someway with low-level network programming to use Socket or DatagraConnections to ping any webserver.....
but I just don't know how to start ;)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11839549
Did you look at that first link I sent you?

http://java.sun.com/developer/J2METechTips/2001/tt0529.html

> Hmm...but there must be someway with low-level network programming to use Socket or DatagraConnections to ping any webserver.....

Nope...  You can try to connect to it, and catch the timeout...  That's about it...
0
 
LVL 35

Expert Comment

by:girionis
ID: 11839553
You can use a socket but it won't be a real ping. Ping uses ICMP packets to do it. I think the best way would be Tim's second comment.
0
 
LVL 35

Accepted Solution

by:
girionis earned 240 total points
ID: 11839582
If you want to *simulate* ping that's how you could do it: http://www.jadcentral.com/newscentral/feature.jsp?feature_ID=49
0
 

Author Comment

by:muaddib33
ID: 11839589
Yes I had a look at the article. The problem is that I want to ping standard webservers and not a server with a running servlet i would programm....
but it seems that isn't possible then ;).

thanx
0
 
LVL 35

Expert Comment

by:girionis
ID: 11839590
>  that's how you could do it

should be

that's *also* how you could do it
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11839637
>  If you want to *simulate* ping that's how you could do it: http://www.jadcentral.com/newscentral/feature.jsp?feature_ID=49

Wouldn't work on our website though, as all ports but 80 are blocked by the firewall...
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11839639
(and the echo port is turned off)

;-)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11882598
I think girionis and I pretty much covered this one...
0
 
LVL 20

Expert Comment

by:Venabili
ID: 11882727
Tim,

Read my comment :) It is an early attempt to wake up the Asker, not the experts ;))

Venabili
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11882756
Hehehe, I know ;-)  Just impatient....21 days is too long ;-)  
0
 

Author Comment

by:muaddib33
ID: 11882819
Sorry - was abroad the last days.
As I want to ping any Web-Servers there doesn't seem to be a solution for realizing this with J2ME.

regards
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11882849
Nope, as we said, you cannot do ICMP "ping" with Java -- either with J2SE, or with J2EE or with J2ME

It has limited support in the new beta J2SE 1.5, but still not in J2ME...  Maybe in the future?  MIDP 3.0?

But I doubt it will arrive for some time...

Tim
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11882855
:-(

bah...

:-(
0
 
LVL 20

Expert Comment

by:Venabili
ID: 11882909
Tim,

That is why I started to wake up Asker earlier. So far - it works :)

muaddib33,
Thanks for returning and closing the question. And sorry that the answer is "No way" :( Sometimes it happens
0
 
LVL 35

Expert Comment

by:girionis
ID: 11883008
It seems unfair to me to get all the points since Tim's answer is also valid, I'd sat valider then mine. Venabili is it ok if I post a "points" to question for Tim?
0
 

Author Comment

by:muaddib33
ID: 11884753
I don't know if there's another way to split or transfer points by now.
Otherwise reopening the question would be ok....
0
 
LVL 35

Expert Comment

by:girionis
ID: 11886362
Thank you for accepting :)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11886838
:-)  Thanks all  :-)

Good luck with it muaddib33 :-)

Tim
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question