J2ME ICMP

Hi,

does anyone know or have the code how to realize a Standard Ping to a webserver using J2ME and get delay times, etc.?
muaddib33Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimYatesCommented:
Short answer, you can't...  MIDP only supports HTTP connections, not ICMP
0
TimYatesCommented:
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
girionisCommented:
You can't even do a pure ping in standard or enterprise java.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

TimYatesCommented:
I know...  I'm not sure why it's never been added :-(
0
TimYatesCommented:
0
TimYatesCommented:
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
girionisCommented:
Nice one, so they are going to (or have already done so) implement "ping" and advanced and raw socket support :)
0
girionisCommented:
> but not do raw socket access (yet)

Yes true, although the state is in progress so soon (hopefully) we might have that too :)
0
muaddib33Author Commented:
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
TimYatesCommented:
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
girionisCommented:
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
girionisCommented:
If you want to *simulate* ping that's how you could do it: http://www.jadcentral.com/newscentral/feature.jsp?feature_ID=49
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
muaddib33Author Commented:
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
girionisCommented:
>  that's how you could do it

should be

that's *also* how you could do it
0
TimYatesCommented:
>  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
TimYatesCommented:
(and the echo port is turned off)

;-)
0
TimYatesCommented:
I think girionis and I pretty much covered this one...
0
VenabiliCommented:
Tim,

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

Venabili
0
TimYatesCommented:
Hehehe, I know ;-)  Just impatient....21 days is too long ;-)  
0
muaddib33Author Commented:
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
TimYatesCommented:
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
TimYatesCommented:
:-(

bah...

:-(
0
VenabiliCommented:
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
girionisCommented:
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
muaddib33Author Commented:
I don't know if there's another way to split or transfer points by now.
Otherwise reopening the question would be ok....
0
girionisCommented:
Thank you for accepting :)
0
TimYatesCommented:
:-)  Thanks all  :-)

Good luck with it muaddib33 :-)

Tim
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.