Hi

I wish someone could confirm to me that Connector.open(socket://...)) or Connector.open(http://...)) on Nokia N70 no longer work over a bluetooth link. Here is my predicament...

I initially had a Nokia N70 phone which I could run the Midlets over bluetooth flawlessly. I had installed Gnubox on the phone and m-router
on the PC. I was also able to access websites from the phone over the bluetooth connection

Now I lost this phone and bought another N70 which i believe had its firmware upgraded to a more recent one. I tried to repeat the same Midlets or even very very simple http Midlet but cannot make it work again. below is the http Midlet (copied from a different thread in this forum). this midlet works on the WTK emulator but not on the phone.

Interestly, i am able to access webpages using Opera or some other web browser on the phone over the bluetooth link. so i believe the link is not the problem. Example also works perfectly on the emulator.

When i run the midlet it throw Java.io.IOException: -18 error

I was thinking that because of the firmware upgrade, Nokia no longer allows
the agent to open a socket connection.

Anyone with the same problem? and more importantly anyone with a solution on how to run agents over bluetooth?

Please any assistance is appreciated. I am using WTK2.5, Microsoft and Toshiba bluetooth stacks, BlueCove.



/**
* The following MIDlet application demonstrates how to establish a
* HttpConnection and uses it to send a GET request to Web server.
*/

// include MIDlet class libraries
import javax.microedition.midlet.*;
// include networking class libraries
import javax.microedition.io.*;
// include GUI class libraries
import javax.microedition.lcdui.*;
// include I/O class libraries
import java.io.*;

public class HttpGET extends MIDlet implements CommandListener {

// A default URL is used. User can change it from the GUI.
private static String defaultURL =
"http://www.google.com";

// GUI components for entering a Web URL.
private Display myDisplay = null;
private Form mainScreen;
private TextField requestField;

// GUI components for displaying server responses.
private Form resultScreen;
private StringItem resultField;

// the "send" button used on mainScreen
Command sendCommand = new Command("SEND", Command.OK, 1);
// the "back" button used on resultScreen
Command backCommand = new Command("BACK", Command.OK, 1);

public HttpGET(){

// initialize the GUI components
myDisplay = Display.getDisplay(this);
mainScreen = new Form("Type in a URL:");
requestField =
new TextField(null, defaultURL,
100, TextField.URL);
mainScreen.append(requestField);
mainScreen.addCommand(sendCommand);
mainScreen.setCommandListener(this);
}

public void startApp() {
myDisplay.setCurrent(mainScreen);
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}

public void commandAction(Command c, Displayable s) {

// when user clicks on the "send" button on mainScreen
if (c == sendCommand) {

// retrieve the Web url that user entered
String urlstring = requestField.getString();

// send a GET request to Web server
String resultstring = "";
try {
resultstring = sendGetRequest(urlstring);
} catch (IOException e) {
resultstring = "ERROR" + e.toString();
}

// display the page content retrieved from Web server
resultScreen = new Form("GET Result:");
resultField =
new StringItem(null, resultstring);
resultScreen.append(resultField);
resultScreen.addCommand(backCommand);
resultScreen.setCommandListener(this);
myDisplay.setCurrent(resultScreen);

} else if (c == backCommand) {

// do it all over again
requestField.setString(defaultURL);
myDisplay.setCurrent(mainScreen);
}
}

// send a GET request to Web server
public String sendGetRequest(String urlstring) throws IOException {

HttpConnection hc = null;
DataInputStream dis = null;

String message = "";
try {

// open up an HttpConnection with the Web server
// the default request method is GET.
hc = (HttpConnection) Connector.open(urlstring);

// obtain a DataInputStream from the HttpConnection
dis = new DataInputStream(hc.openInputStream());

// retrieve the contents of the requested page from Web server
int ch;
while ((ch = dis.read()) != -1) {
message = message + (char) ch;
}
} finally {
if (hc != null) hc.close();
if (dis != null) dis.close();
}
return message;
}
}