You Are Here:

Community: Developer Discussion Boards

#1 Old HttpConnection with Nokia 3650 - 2004-03-24, 17:24

Join Date: Mar 2004
Posts: 3
silvio100
Offline
Registered User
please help me...

why this MIDlet don't work?
It is simple HTTP connection but it don't work with Nokia 3650...


import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

public class SimpleConnetcion extends MIDlet {

private Display display;

String url = "http://141.108.248.148/tesi/prova.php";

public SimpleConnection() {
display = Display.getDisplay(this);
}

public void startApp() {
try {
getViaStreamConnection(url);
} catch (IOException e) {
//Handle Exceptions any other way you like.
System.out.println("IOException " + e);
e.printStackTrace();
}
}

public void pauseApp() { }
public void destroyApp(boolean unconditional) { }

void getViaStreamConnection(String url) throws IOException {
StreamConnection streamConnection = null;
InputStream inputStream = null;
StringBuffer b = new StringBuffer();
TextBox textBox = null;
try {
streamConnection = (StreamConnection)Connector.open(url);
inputStream = streamConnection.openInputStream();
int ch;
while((ch = inputStream.read()) != -1) {
b.append((char) ch);
}
textBox = new TextBox("Simple URL Fetch", b.toString(), 1024, 0);
} finally {
if(inputStream != null) {
inputStream.close();
}
if(streamConnection != null) {
streamConnection.close();
}
}
display.setCurrent(textBox);
}
}


Thanks
Reply With Quote

#2 Old 2004-03-24, 22:06

Join Date: Jun 2003
Posts: 75
fabiolee
Offline
Regular Contributor
what is the data at server side? video, audio, textfile?
Reply With Quote

#3 Old 2004-03-25, 11:34

Join Date: Mar 2004
Posts: 3
silvio100
Offline
Registered User
it is a simple php file:


<?php
$data = date('H:i:s');
echo $data;
?>
Reply With Quote

#4 Old 2004-03-25, 12:57

Join Date: Nov 2003
Posts: 145
dotcdotc's Avatar
dotcdotc
Offline
Regular Contributor
well ur coding seems ok.

is it giving some error or message

if yes then what is that



dotc
Reply With Quote

#5 Old 2004-03-25, 14:00

Join Date: Mar 2004
Posts: 3
silvio100
Offline
Registered User
nothing...
no message error...

it is worrisome?

:)

I think that the 3650 is not adapted to the development with Java.
Reply With Quote

#6 Old 2004-05-13, 06:59

Join Date: Oct 2003
Posts: 149
Location: Portland, OR
Send a message via MSN to mshita Send a message via Yahoo to mshita
mshita
Offline
Regular Contributor
I have no problem getting http connection to work on my 3650. Try changing your php file to maybe set something in a MySQL database. That way you'll know if it actually connects to the site.
Reply With Quote

#7 Old Re: HttpConnection with Nokia 3650 - 2005-09-22, 13:06

Join Date: Feb 2005
Posts: 11
Location: Bangalore
pcrama
Offline
Registered User
IT will work with MIDP 2.0 device
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia