wood burning stoves 2.0*
The moose likes Java Micro Edition and the fly likes how do i create connection for a cell phone Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "how do i create connection for a cell phone" Watch "how do i create connection for a cell phone" New topic
Author

how do i create connection for a cell phone

Madhup narain bhardwaj
Greenhorn

Joined: Feb 12, 2004
Posts: 5
hi mates!!
i have been developing an application for a cell phone,which requires me to constantly interact with a backend server and a cellphone, earlier on i was using a connection object like
sc = (StreamConnection)Connector.open("socket://XXX.XXX.XXX.XXX:9999");
which seemed to be working fine on emulators.
My problem started when i ported the application over a cell phone.
The connection seemed not to work.Is there any way that i can get data flowing like it was in the emulators??
I havent used servlets, and modifying my code for servlets will require rewritting the entire application again.
Help me out will ya!!
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Does your phone support socket connections? (if it isn't a MIDP 2.0 phone, it probably doesn't)


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Madhup narain bhardwaj
Greenhorn

Joined: Feb 12, 2004
Posts: 5
well
if i have to develope an application i guess so that i must do it so that it would support all the phones.
How do i actually go about doing so, also assuming that my phone does not support MIDP 2.0
all replies will be appreciated
thanks
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
The problem is that only MIDP 2.0 phones are required to support socket connections ("socket://") -- MIDP 1.0 phones can optionally support socket connections but 99,99% of them don't.
If you want to support all MIDP phones, you'll have to resort to HTTP connections instead of raw sockets.
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
"I havent used servlets, and modifying my code for servlets will require rewritting the entire application again.
Help me out will ya!!"

No, one servlet is enough!
serge masse
Ranch Hand

Joined: Jul 23, 2003
Posts: 102
Please note that the MIDP 2 spec does not require that the device supports socket connections. The spec only recommends that the device supports them. Therefore, in mid-2004, most MIDP2-compliant phones do not support sockets and furthermore, even if you purchase a device that has a version of a MIDP2 runtime that supports sockets (such as the Treo 600 with your installation of IBM MIDP2 JVM), it is likely that the carrier does not support TCP sockets, as most don't today.

We must raise flags in order to change the situation. Lets do it at JavaOne at the end of June.

See you at JavaOne
serge masse - BOF-1019 - Wednesday June 30, 7:30 PM


serge - http://goo.gl/GgF7R - my android apps
 
GeeCON Prague 2014
 
subject: how do i create connection for a cell phone