Solved

J2ME ICMP

Posted on 2004-08-19
31
804 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 170 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Expert Comment

by:TimYates
ID: 11839556
0
 
LVL 35

Accepted Solution

by:
girionis earned 80 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…

617 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