midlet error when using httpconnection in netbeans

O

Orson

hi,
i'm quite new in writing midlets, so maybe answer to my question is
obviuos.
my application needs to use http connection but when i try to run it
the whole emulator (DefaultColorPhone) stops and a message is
displayed that application "wants to send and recieve data using the
network. This will use airtime and may result in charges. Is it ok to
use airtime?". there are two options yes/no but application isn't
responding.
the same situation occurs when i try to run sample application which
use any type of connection.

if anyone had this kind of problem please respond.
yours sincerely
orson
 
D

Darryl Pierce

Orson said:
i'm quite new in writing midlets, so maybe answer to my question is
obviuos.
my application needs to use http connection but when i try to run it
the whole emulator (DefaultColorPhone) stops and a message is
displayed that application "wants to send and recieve data using the
network. This will use airtime and may result in charges. Is it ok to
use airtime?". there are two options yes/no but application isn't
responding.
the same situation occurs when i try to run sample application which
use any type of connection.

Can you show us the code you're using to create the HTTP connection? It
sounds like you're blocking the main thread by opening the connection on
that thread rather than spawning a new thread to handle the connection...
 
Joined
Sep 5, 2007
Messages
3
Reaction score
0
http connection error

Orson said:
hi,
i'm quite new in writing midlets, so maybe answer to my question is
obviuos.
my application needs to use http connection but when i try to run it
the whole emulator (DefaultColorPhone) stops and a message is
displayed that application "wants to send and recieve data using the
network. This will use airtime and may result in charges. Is it ok to
use airtime?". there are two options yes/no but application isn't
responding.
the same situation occurs when i try to run sample application which
use any type of connection.

if anyone had this kind of problem please respond.
yours sincerely
orson



i want to transfer file from computer to mobile. getting same type of error : do u want to use airtime ? nothing happens irrespective of reply and the midlet hangs..
i tried using localhost.. this time the midlet doesn't hang but instead of reading and displaying file contents, it shows this : 'Error ..'

please reply if anyone has some solution for me

one more thing i need to know is what are the prerequisites for installing eclipse 3.0?
 
Joined
Aug 26, 2008
Messages
3
Reaction score
0
hello im Ashok ,Im facing this same problem when i try to call servlet from midlet by using
(HttpConnection) open(url);
 
Joined
Aug 26, 2008
Messages
3
Reaction score
0
below i pasted the code , in that im facing 'Is it ok to use Airtime?' msg on my midlet screen. plz tell me clearly and i using new thread to establish the connection. eventhough im facing the same problem. explain me clearly
 
Joined
Aug 26, 2008
Messages
3
Reaction score
0
below i pasted the code , in that im facing 'Is it ok to use Airtime?' msg on my midlet screen. plz tell me clearly and i using new thread to establish the connection. eventhough im facing the same problem. explain me clearly

code:

private void callServlet()
{
//throw new UnsupportedOperationException("Not yet implemented");
System.out.println("from call servlet b4 thread start");
//thread.start();

new Thread(this).start();


}




public void run()
{

System.out.println("from run()");

HttpConnection http = null;
InputStream iStrm = null;
boolean ret = false;


String source_stn="MS";
String dest_stn="PER";



String url = "http://localhost:8080/WebUTSApplication/MobileServlet"+"?"+"src_stn=" + source_stn+"&"+"des_stn=" + dest_stn;
//String url = "http://localhost:8080/WebUTSApplication/MobileServlet";
// String baseurl = "http://localhost:8080/WebUTSApplication/MobileServlet";
System.out.println("URL ="+url);


try {

System.out.println("with in try block");
http = (HttpConnection) Connector.open(url);
System.out.println("after open url");
//http = open(url);
http.setRequestMethod(HttpConnection.POST);

//http.setRequestMethod(HttpConnection.GET);



} catch (IOException ex) {
ex.printStackTrace();
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top