Master question! Connector.open... network

A new problem has occured!
Something strange happens when the connect-statement in the run-method
is executed. When this happen, J2ME sets up a screen asking if it's
right to use the net to send/receive. Nothing happens when the yes or no button
is pressed. What should happens (when no threading is used) is the program to
continue after one of the buttons has been pressed. What kind of deadlock is this?
The SendThread-class works fine if there is another processing task in the run method,
for instance a loop doing a calculation or similar. The code is tested using
Wireless Toolkit.
How can I fix this?
Thanks for any feedback/help!
public class Testing extends MIDlet
public void startApp()
SendThread thread = new SendThread( -1, null, null, null );
thread.start();
progressBar( thread );
System.out.println( thread.getResult() );
public void pauseApp()
public void destroyApp( boolean unconditional )
private void progressBar( SendThread thread )
System.out.print( "Progress bar" );
while( !thread.completed() )
System.out.print( "." );
public class SendThread extends Thread
private boolean completed;
private int action;
private Employee employee;
private Week week;
private String[] userinfo;
private String result;
public SendThread( int action, Employee employee, Week week, String[] userinfo )
this.action = action;
this.employee = employee;
this.week = week;
this.userinfo = userinfo;
public void run()
connection = (HttpConnection)Connector.open( "http://www.gentoo.org",
Connector.READ_WRITE ); completed = true;
public boolean completed()
return completed;
public String getResult()
return result;
}

Well, new update. The code above actually works fine, but
when I construct the SendThread-object from the
commandAction-method, the problem described above
occurs...anybody with suggestions?

Similar Messages

  • Question about open network and Airport

    Hi,
    in my school there is a open network that allows me to surf the web with my MacBook, but my room has a very bad location so for me to connect to the network I have to put my MacBook in the window of the room. I always try to connect from inside the room but I don't have signal available. My question is: can I use some sort of Airport extreme, express or generic Wireless Router to capture the signal in the window and then send it to the inside of my room??? Any suggestions, websites? I have no access to the router (no admin access to configure).
    Thanks!
    PS: Sorry, english it's not my first language (writing from Chile)...
    Best,
    AUP

    Do you need to be wireless in your room?
    If not then an ethernet wireless bridge would be a possibility such as the Linksys WET54G.
    If you want to be wireless you could use a Linksys WET54G to pick up the signal from the Window and then connect a wireless access point (such as the Airport Express or any cheap 802.11g wireless access point) to the WET54G for wireless access.
    iFelix

  • How to connect my iMac G4 to my network, it wont let me something about the password but I connect to a open network???Ask your question.

    Hello I have been trying to connect my iMac G4 to my network but I can't. I have a secure network with a password and is not let me in but I can connect to an open network with no password??? anybody can help???

    AirPort card in iMac G4 does not support strong WiFi encryption.
    I think WPA is the maximum for that WiFi card.
    If you have WPA2 in your WiFi network, you need to downgrade (not recommended)or wired connect the iMac G4.

  • SOCKET NOT WORK PHONE (works on emulator)  ,,, freezes at Connector.open

    Hi everyone, dukes to those who can ease my brain pain.
    I'm using the example SocketMIDlet app that comes with Sun JavaTM Wireless Toolkit for CLDC Version 2.5.
    Client and server works ok on emulator.
    THEN I attempt running server on PC and Client on Nokia N95.
    IP address in Client's Connector.open("socket://...) is the IP address shown when I do IPCONFIG on my PC. My PC is connected to the internet via ADSL router.
    When I run the client on the phone, it asks for access point, I select
    1) vodafoneLive (i.e. internet access point.) Is this correct? is it possible to socket over the internet (dum question I know) ,,,
    or should I connect to
    2) my wireless network access point instead (where the pc is connected to)
    although that doesnt work either, but just want to know if point 1 is actually possible.
    See code below, it seems to be freezing at the Connector.open statement, because the textfield is not even updating with "connected..." and nothing is reported at the server end.
    No exceptions are reported.
    Tested on Nokia emulator, connected ok, but send from client didnt work, so added a flush statement in, so that's good now. But still, the connect is what is not working.
    Anyone come across this before ????
    Here is the code... the client and server (2nd and 3rd procs below) are the interesting ones....
    Much appreciated if someone can help,,, suspect a setup problem? but who knows...
    *PLEASE HELP*
    SocketMIDlet.java
    {code}
    * @(#)SocketMIDlet.java     1.6 03/10/29
    * Copyright (c) 2000-2003 Sun Microsystems, Inc. All rights reserved.
    * PROPRIETARY/CONFIDENTIAL
    * Use is subject to license terms
    import javax.microedition.midlet.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import java.io.*;
    public class SocketMIDlet extends MIDlet implements CommandListener {
    private static final String SERVER = "Server";
    private static final String CLIENT = "Client";
    private static final String[] names = {SERVER, CLIENT};
    private static Display display;
    private Form f;
    private ChoiceGroup cg;
    private boolean isPaused;
    private Server server;
    private Client client;
    private Command exitCommand = new Command("Exit", Command.EXIT, 1);
    private Command startCommand = new Command("Start", Command.ITEM, 1);
    public SocketMIDlet() {
    display = Display.getDisplay(this);
    f = new Form("Socket Demo");
    cg = new ChoiceGroup("Please select peer",
    Choice.EXCLUSIVE, names, null);
    f.append(cg);
    f.addCommand(exitCommand);
    f.addCommand(startCommand);
    f.setCommandListener(this);
    display.setCurrent(f);
    public boolean isPaused() {
    return isPaused;
    public void startApp() {
    isPaused = false;
    public void pauseApp() {
    isPaused = true;
    public void destroyApp(boolean unconditional) {
    if (server != null) {
    server.stop();
    if (client != null) {
    client.stop();
    public void commandAction(Command c, Displayable s) {
    if (c == exitCommand) {
    destroyApp(true);
    notifyDestroyed();
    } else if (c == startCommand) {
    String name = cg.getString(cg.getSelectedIndex());
    if (name.equals(SERVER)) {
    server = new Server(this);
    server.start();
    } else {
    client = new Client(this);
    client.start();
    {code}
    Server.java
    {code}
    * @(#)Server.java     1.6 03/07/15
    * Copyright (c) 2000-2003 Sun Microsystems, Inc. All rights reserved.
    * PROPRIETARY/CONFIDENTIAL
    * Use is subject to license terms
    import javax.microedition.midlet.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import java.io.*;
    public class Server implements Runnable, CommandListener {
    private SocketMIDlet parent;
    private Display display;
    private Form f;
    private StringItem si;
    private TextField tf;
    private boolean stop;
    private Command sendCommand = new Command("Send", Command.ITEM, 1);
    private Command exitCommand = new Command("Exit", Command.EXIT, 1);
    InputStream is;
    OutputStream os;
    SocketConnection sc;
    ServerSocketConnection scn;
    Sender sender;
    public Server(SocketMIDlet m) {
    parent = m;
    display = Display.getDisplay(parent);
    f = new Form("Socket Server");
    si = new StringItem("Status:", " ");
    tf = new TextField("Send:", "", 30, TextField.ANY);
    f.append(si);
    f.append(tf);
    f.addCommand(exitCommand);
    f.setCommandListener(this);
    display.setCurrent(f);
    public void start() {
    Thread t = new Thread(this);
    t.start();
    public void run() {
    try {
    si.setText("Waiting for connection");
    scn = (ServerSocketConnection) Connector.open("socket://:5000");
    // Wait for a connection.
    sc = (SocketConnection) scn.acceptAndOpen();
    si.setText("Connection accepted");
    is = sc.openInputStream();
    os = sc.openOutputStream();
    sender = new Sender(os);
    // Allow sending of messages only after Sender is created
    f.addCommand(sendCommand);
    while (true) {
    StringBuffer sb = new StringBuffer();
    int c = 0;
    while (((c = is.read()) != '\n') && (c != -1)) {
    sb.append((char) c);
    if (c == -1) {
    break;
    si.setText("Message received - " + sb.toString());
    stop();
    si.setText("Connection is closed");
    f.removeCommand(sendCommand);
    } catch (IOException ioe) {
    if (ioe.getMessage().equals("ServerSocket Open")) {
    Alert a = new Alert("Server", "Port 9999 is already taken.",
    null, AlertType.ERROR);
    a.setTimeout(Alert.FOREVER);
    a.setCommandListener(this);
    display.setCurrent(a);
    } else {
    if (!stop) {
    ioe.printStackTrace();
    } catch (Exception e) {
    e.printStackTrace();
    public void commandAction(Command c, Displayable s) {
    if (c == sendCommand && !parent.isPaused()) {
    sender.send(tf.getString());
    if ((c == Alert.DISMISS_COMMAND) || (c == exitCommand)) {
    parent.notifyDestroyed();
    parent.destroyApp(true);
    * Close all open streams
    public void stop() {
    try {
    stop = true;
    if (is != null) {
    is.close();
    if (os != null) {
    os.close();
    if (sc != null) {
    sc.close();
    if (scn != null) {
    scn.close();
    } catch (IOException ioe) {}
    {code}
    Client.java
    {code}
    * @(#)Client.java     1.6 03/07/15
    * Copyright (c) 2000-2003 Sun Microsystems, Inc. All rights reserved.
    * PROPRIETARY/CONFIDENTIAL
    * Use is subject to license terms
    import javax.microedition.midlet.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import java.io.*;
    public class Client implements Runnable, CommandListener {
    private SocketMIDlet parent;
    private Display display;
    private Form f;
    private StringItem si;
    private TextField tf;
    private boolean stop;
    private Command sendCommand = new Command("Send", Command.ITEM, 1);
    private Command exitCommand = new Command("Exit", Command.EXIT, 1);
    InputStream is;
    OutputStream os;
    SocketConnection sc;
    Sender sender;
    public Client(SocketMIDlet m) {
    parent = m;
    display = Display.getDisplay(parent);
    f = new Form("Socket Client");
    si = new StringItem("Status:", " ");
    tf = new TextField("Send:", "", 30, TextField.ANY);
    f.append(si);
    f.append(tf);
    f.addCommand(exitCommand);
    f.addCommand(sendCommand);
    f.setCommandListener(this);
    display.setCurrent(f);
    * Start the client thread
    public void start() {
    Thread t = new Thread(this);
    t.start();
    public void run() {
    try {
    sc = (SocketConnection) Connector.open("socket://155.35.122.238:5000");
    si.setText("Connected to server");
    is = sc.openInputStream();
    os = sc.openOutputStream();
    // Start the thread for sending messages - see Sender's main
    // comment for explanation
    sender = new Sender(os);
    // Loop forever, receiving data
    while (true) {
    StringBuffer sb = new StringBuffer();
    int c = 0;
    while (((c = is.read()) != '\n') && (c != -1)) {
    sb.append((char) c);
    if (c == -1) {
    break;
    // Display message to user
    si.setText("Message received - " + sb.toString());
    stop();
    si.setText("Connection closed");
    f.removeCommand(sendCommand);
    } catch (ConnectionNotFoundException cnfe) {
    Alert a = new Alert("Client", "Please run Server MIDlet first",
    null, AlertType.ERROR);
    a.setTimeout(Alert.FOREVER);
    a.setCommandListener(this);
    display.setCurrent(a);
    } catch (IOException ioe) {
    if (!stop) {
    Alert a = new Alert("Client", "Franco IOException: " + ioe.toString(),
    null, AlertType.ERROR);
    a.setTimeout(Alert.FOREVER);
    a.setCommandListener(this);
    display.setCurrent(a);
    ioe.printStackTrace();
    } catch (Exception e) {
    Alert a = new Alert("Client", "Franco Exception: " + e.toString(),
    null, AlertType.ERROR);
    a.setTimeout(Alert.FOREVER);
    a.setCommandListener(this);
    display.setCurrent(a);
    e.printStackTrace();
    public void commandAction(Command c, Displayable s) {
    if (c == sendCommand && !parent.isPaused()) {
    sender.send(tf.getString());
    if ((c == Alert.DISMISS_COMMAND) || (c == exitCommand)) {
    parent.notifyDestroyed();
    parent.destroyApp(true);
    * Close all open streams
    public void stop() {
    try {
    stop = true;
    if (sender != null) {
    sender.stop();
    if (is != null) {
    is.close();
    if (os != null) {
    os.close();
    if (sc != null) {
    sc.close();
    } catch (IOException ioe) {}
    {code}
    Sender.java
    {code}
    * @(#)Sender.java     1.4 03/03/02
    * Copyright (c) 2000-2003 Sun Microsystems, Inc. All rights reserved.
    * PROPRIETARY/CONFIDENTIAL
    * Use is subject to license terms
    import javax.microedition.midlet.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import java.io.*;
    public class Sender extends Thread {
    private OutputStream os;
    private String message;
    public Sender(OutputStream os) {
    this.os = os;
    start();
    public synchronized void send(String msg) {
    message = msg;
    notify();
    public synchronized void run() {
    while(true) {
    // If no client to deal, wait until one connects
    if (message == null) {
    try {
    wait();
    } catch (InterruptedException e) {
    if (message == null) {
    break;
    try {
    os.write(message.getBytes());
    os.write("\r\n".getBytes());
    os.flush();
    } catch (IOException ioe) {
    ioe.printStackTrace();
    // Completed client handling, return handler to pool and
    // mark for wait
    message = null;
    public synchronized void stop() {
    message = null;
    notify();
    {code}

    ok, apologies to anyone who has read this and gotten a headache from my stupidity... testing with a work collegue, who you can guess called me an idiot, advised that I was trying to use the ip address as known within my home lan, and that I needed to use the ipaddress as seen externally.
    So, looked at my linksys router admin and found the external ip address. Tested pinging to it, all good. BUT, cannot telnet to that ipaddress port of the java server running on the pc.
    So at this point, the problem is not j2me related.... have started another thread to look at THAT problem, when that is solved, I'm sure there will STILL be problems here, or maybe not... so once that link is addressed, I'll come back here.

  • Problems connecting to a Open Network via Wi-fi on Cisco Router

    Hi everyone, I know I'm new here but I'm in need of your help, so if you can assist please do so as I cannot live without wi-fi and might have to go back to my nokia again if I can't sort this out.
    Vodafone finally released the Iphone on their network in Ireland today and I've picked a 3gs up straight away.
    At work I have a wi-fi network with a CISCO router (I have no access to the router as only IT do and they won't change anything to satisfy me and my Iphone anyways). This network has no encryption whatsoever and its free to join, you don't need any password or anything. My nokia at the start couldn't connect as it said that the network needed a pre shared key, this isn't true and in the end it was just change a setting to no auth required for it to log into the network and work perfectly.
    Today I got to work and the Iphone can't connect to the network, just says it can't join the network. I cannot find anything about authentication on the settings of the phone nor can I work around this at all. I've had a Ipod touch for (the 2nd gen) for over 2 years and I gave up trying to set it up at work because I just couldn't find what was wrong with it, I ended up almost not using it other than when traveling or on the gym.
    So first question is there any way I can access the authentication settings for wi-fi connections on the Iphone? Maybe its just a little change that is needed like the nokia.
    Has anyone experienced this problem on a open network that they cannot join?
    Any other sugestions? Anything really?
    Thank you very much for your time guys, I would really really appreciate your help on this.
    Regards,
    Rod
    PS: I've also tried to install the Iphone configuration utility however I don't know how to access the profiles on the phone, anyone can help with this so I can try the profile I've created?
    I don't think it is going to work because the options available on the configuration utility are basicly the same available on the Iphone itself.
    Anyone has any sugestion on how to solve this problem??? Thanks very much.

    Sun Mar 28 06:02:24 unknown Preferences[292] <Warning>: wifi handler: (null)
    Sun Mar 28 06:02:27 unknown kernel[0] <Debug>: AppleBCMWLAN::setASSOCIATE() [configd]: lowerAuth = AUTHTYPE_OPEN, upperAuth = AUTHTYPE_NONE, key = CIPHER_NONE, flags = 0x0
    Sun Mar 28 06:02:27 unknown configd[22] <Error>: WiFi:[//////////////////>: Failed to associate with Internet: 5
    Sun Mar 28 06:02:27 unknown kernel[0] <Debug>: AppleBCMWLANJoinManager::join(): No such network: "Internet"
    Sun Mar 28 06:02:27 unknown Preferences[292] <Warning>: WiFiManagerAssociationCallback: err(5), err(00000005)
    This is what I get on the Iphone configuration utility debug console. I edited out just a couple of numbers in case this is sensitive information the company wouldn't want me to share.
    Message was edited by: F-22

  • Question on how networking works with new Macbook Pro

    Hi,
    I have a question about how networking works with my new Macbook Pro. This is my first laptop so am new to mobile computing. I am about to configure it to replace my desktop which uses a wired DSL connection. Once I have my Macbook Pro configured to run off the DSL modem, what happens when I take this computer to a location that has ethernet? Will just plugging in the ethernet cable be enough to get on line? Or is there further configuration work that needs to be done?
    I used a Windows laptop from work and all I had to do was plug it in to a hotel ethernet cable to get on line. However, this laptop was never configured to run on my DSL network so I am not certain if that makes things more complicated.
    Thanks for your help!

    Hi
    Your MacBook Pro should just work when plugged into an ethernet connection.
    Just check something, Open Network Preferences, you can select it from the Airport icon in the menu bar.
    In the left-hand pane click on Ethernet and just check that it is set to configure using DHCP in the right-hand pane, that's it.
    So when you plug in the ethernet cable it will ask the router for an IP address and off you go.
    I assume that any system you plug into will use DHCP rather than static IP addresses. If it is a static IP address, you will need to manually configure the ethernet settings by inputting the IP address and subnet mask info plus DNS servers.
    Usually it is done with DHCP and you don't have to do a thing and likewise your home DSL is DHCP?
    If not then you will have to change your settings, make a 'Hotel' setting which you can use when in hotels and keep your 'Home' set-up for when you are at home. In the pull down menu select Edit Locations to add new ones.
    Phil
    Message was edited by: Philip Tyler

  • A question about opening ports

    I have a question about opening ports with the airport. I need to open up ports UDP 88 & 3074 and port TCP 3074. I am wondering if I should open these ports for the specific IP address on my network that will be using them or if I should open the ports on the gateway IP (10.0.1.1) not sure which is the right route to take. Any help would be appreciated.
    These are for running an xbox over xbox live.

    Typically, you will want to open these ports for the device on your local network that needs to be accessed from the Internet. In this case, it would be your Xbox 360.
    Unfortunately, the AirPorts are not listed as Xbox Live-compatible routers ... so there is no guarantee doing this will get Open NAT status for Xbox Live.
    The following web blog does a great job explaining the NAT issues with Xbox Live. Basically what it comes down to is that although you can get an Internet connection for the Xbox 360 with the AirPorts, you may not get the necessary NAT setting (Moderate or Open) for the Xbox Live game that you want to play. As such, Port mapping may be required to allow Xbox Live access.
    The following ports must be available for Xbox Live to operate correctly:
    • UDP 88
    • UDP 3074
    • TCP 3074
    To setup port mapping on an 802.11n AirPort Extreme Base Station (AEBSn), either connect to the AEBSn's wireless network or temporarily connect directly, using an Ethernet cable, to one of the LAN port of the AEBSn, and then use the AirPort Utility, in Manual Setup, to make these settings:
    1. Reserve a DHCP-provided IP address for the Xbox 360.
    Internet > DHCP tab
    o On the DHCP tab, click the "+" (Add) button to enter DHCP Reservations.
    o Description: <enter the desired description of the host device>
    o Reserve address by: MAC Address
    o Click Continue.
    o MAC Address: <enter the MAC hardware address of the Xbox>
    o IPv4 Address: <enter the desired IP address>
    o Click Done.
    2. Setup Port Mapping on the AEBSn.
    Advanced > Port Mapping tab
    o Click the "+" (Add) button
    o Service: <choose the appropriate service from the Service pop-up menu>
    o Public UDP Port(s): 88, 3074
    o Public TCP Port(s): 3074
    o Private IP Address: <enter the DHCP Reserved IP address for the Xbox you created earlier>
    o Private UDP Port(s): 88, 3074
    o Private TCP Port(s): 3074
    o Click "Continue"

  • Unable to map master page gallery as network drive for migrated sitecollection

    Hi all,
    I am unable to map the masterpage gallery as network drive for design manager for a migrated site.
    This is a windows 2008 server r2 OS. Desktop experience in installed.
    I am able to map the master page gallery as network drive for two other site collections which is not migrated.
    But for the current migrated sitecollection, it throws the familiar error that it is unable to connect.... I already tried unistalling and reinstalling desktop experience.
    Kindly help.

    Hi sanjuv,
    According to your description, my understanding is that you can't map master page gallery in network drive for certain migrated site collection.
    If you can open the master gallery with explorer, it means the master page gallery really exists. I suggest you check if the path is valid in the network drive. You can find the detailed path information with the articles below:
    1.On the site for which you are creating a design, start Design Manager. (For example, on the Settings menu, choose Design Manager.)
    2.In the numbered list, select Upload Design Files.
    3.The Design Manager: Upload Design Files page contains the location of the Master Page Gallery. The location probably ends in /_catalogs/masterpage/. This is the location to which you will map a network drive.
    4.Make a note of the location of the Master Page Gallery, or copy it to the Clipboard.
    Here is a detailed article for your reference:
    Map a network drive to the SharePoint 2013 Master Page Gallery
    If the issue still exists , I suggest you can check the link below to troubleshooting the connection error with Network drive. You can try to install the kb of IE10 below to test if it works.
    https://support.microsoft.com/kb/2616712/en-au?wa=wsignin1.0
    https://support.microsoft.com/kb/2846960
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • Connector.open(String url) function problem

    Hi All
    I made HttpConnection with Connector.open function, but program block exactly on this function call, I think it's cause &#1072; poor connection what I have on my phone, so my question is: Is there a way to get out from this blocking?
    I must say that I make connection in a separate thread and I catch all exception from a function.
    Thank you for your replays.

    I can't see enything on url you posted, what you mean that I answer to my question.
    thanks for replay.

  • TS1317 I can't connect to my network, but can to an open network in the community.  I think it's the password, I've forgotten it.  How do I set a new password?

    My ISP has just installed a new modem with an ethernet connection, which I have plugged into my Airport Express.  I'm able to connect to an open network in the neighborhood but not to my own network that I had set up before.  I have done some troubleshooting, the modem is working when connected to my computer.  It may just be the password, it's not accepting the password that I thought I had used to set up the Airport Express when I first bought it.  Should I be using the same password as in my Accounts on my Mac's System Preferences?

    ...  Would the network password be the same as my Mac's password?
    It can be if you configured it that way, but since that is apparently not working for you it's probably not the same. You can reconfigure the Express easily enough using AirPort Utility - it is in your Utilities folder, which is found within your Applications folder.
    Launch AirPort utility, then reset the Express:
    To reset your Express:
    Press and hold the reset button with a pen or pencil for 1 full second. The light (LED) will flash amber, indicating that the AirPort Express is in soft reset mode.
    This will enable you to use AirPort Utility to reset your network password.
    Note: If you do not make your changes within five minutes of pressing the reset button, AirPort Express will return to its previous configuration. The light will change back to solid green (or whatever state it was in before the reset).
    Resetting an AirPort Base Station or Time Capsule FAQ

  • Whenever I try to open Network browser it gets an error.

    I was trying to open Network Browser and I got this error: "Network Browser is unable to launch because your system software is not configured properly.".
    I really want to start this,
    My computer is a iBook Clamshell g3 Blue-Berry,
    running Mac OS 9.2.2.
    I have 64 MB of RAM,
    and a 6 GB hard drive,
    Thanks.

    I really need Help! Please.
    I was trying to open Network Browser and I got this error: "Network Browser is unable to launch because your system software is not configured properly.".
    I really want to start this,
    My computer is a iBook Clamshell g3 Blue-Berry,
    running Mac OS 9.2.2.
    I have 64 MB of RAM,
    and a 6 GB hard drive,
    Thanks.

  • Unable to open Network System Preferences

    When I want to open Network System Preferences I get the message "Your network settings have been changed by another application". When I click "OK" the message keeps reappearing. The only way out is a Force Quit of System Preferences. What does this message mean and what can be done about it?
    Maybe it's worth mentioning that I had to reinstall Mac OS a few days ago due to a screwed up security update. Could it have something to do with that? Apart from this my iBook works fine and I have no networking problems.
    Thanks for any helpful advice.
    Paul

    Hi John
    That didn't work but thanks anyway.
    In the meantime I found another topic under "Mac OS X Tiger" that I had overlooked before dealing with this problem. It obviously has to do with the latest security update.
    Paul

  • Connection refused--while executing (HttpConnection) Connector.open(url);

    Hi,
    i'm using netbeans mobility 5.0
    as i was new to this mobile programming i'm getting the output as "Connection Refused"
    plz plz plz plz....... help me out from this problem
    here is my code..
    code:_
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.io.*;
    import java.io.*;
    public class FileViewer extends MIDlet implements CommandListener
    private Display display; // Reference to Display object
    private TextBox tbViewer; // View file contents in a textbox
    private Command cmView; // Command to view file
    private Command cmExit; // Command to exit
    private String url = "http://www.corej2me.com/midpbook_v1e1/scratch/fileViewer.hlp";
    public FileViewer()
    display = Display.getDisplay(this);
    // Define commands
    cmView = new Command("View", Command.SCREEN, 2);
    cmExit = new Command("Exit", Command.EXIT, 1);
    tbViewer = new TextBox("Viewer", "", 250, TextField.ANY);
    tbViewer.addCommand(cmView);
    tbViewer.addCommand(cmExit);
    tbViewer.setCommandListener(this);
    public void startApp()
    display.setCurrent(tbViewer);
    private void viewFile() throws IOException
    HttpConnection http = null;
    InputStream iStrm = null;
    try
    http = (HttpConnection) Connector.open(url);
    // Client Request
    // 1) Send request method
    http.setRequestMethod(HttpConnection.GET);
    // 2) Send header information (this header is optional)
    http.setRequestProperty("User-Agent", "Profile/MIDP-1.0 Configuration/CLDC-1.0");
    // 3) Send body/data - No data for this request
    // Server Response
    // 1) Get status Line
    System.out.println("Msg: " + http.getResponseMessage());
    System.out.println("Code: " + http.getResponseCode());
    // 2) Get header information
    if (http.getResponseCode() == HttpConnection.HTTP_OK)
    // 3) Get data (show the file contents)
    iStrm = http.openInputStream();
    int length = (int) http.getLength();
    if (length > 0)
    byte serverData[] = new byte[length];
    iStrm.read(serverData);
    tbViewer.setString(new String(serverData));
    finally
    if (iStrm != null)
    iStrm.close();
    if (http != null)
    http.close();
    public void pauseApp()
    public void destroyApp(boolean unconditional)
    public void commandAction(Command c, Displayable s)
    if (c == cmView)
    try
    viewFile();
    catch (Exception e)
    System.out.println(e.toString());
    else if (c == cmExit)
    destroyApp(false);
    notifyDestroyed();
    output*
    build.xml(debug)*
    some....
    Application descriptor does not declare any MIDlet. Direct execution is not allowed.
    Generated "C:\Documents and Settings\Lakshmi Narayan J\jlnexample\dist\jlnexample.jar" is 2655 bytes.
    post-jar:
    debug:
    C:\Documents and Settings\Lakshmi Narayan J\jlnexample\src\.timestamp
    Starting emulator in debug server mode on port 1469
    com.sun.kvem.midletsuite.InvalidJadException: Reason = 22
    The manifest or the application descriptor MUST contain the attribute: MIDlet-1
    nbdebug:
    KdpDebugTask connecting to debugger 1 ..
    KdpDebugTask connecting to debugger 2 ..
    KdpDebugTask connecting to debugger 3 ..
    KdpDebugTask connecting to debugger 4 ..
    KdpDebugTask connecting to debugger 5 ..
    Connecting JPDA Debugger to emulator timed out after 5 attempts and 31 seconds.
    C:\Documents and Settings\Lakshmi Narayan J\jlnexample\nbproject\build-impl.xml:306: The following error occurred while executing this line:
    C:\Documents and Settings\Lakshmi Narayan J\jlnexample\nbproject\build-impl.xml:311: Connecting JPDA Debugger to emulator timed out after 5 attempts and 31 seconds.
    BUILD FAILED (total time: 43 seconds)
    Debugger console:
    Attaching to localhost:1469
    Connection refused.
    Edited by: LAKSHMI_NARAYAN_J on Jun 23, 2008 9:54 AM

    It's called potential deadlock. The emulator blocks your app 'cause any connection and commandAction needs its own thread. So I suggest use a new thread with this http connection then your program will be run successful.

  • Unable to open file in emulator using Connector.open()

    This is my code (run on emulator) used to open a file located in the dir: C:\WTK25\appdb\DefaultColorPhone\filesystem\root1
    /**************************************CODE***********************************/
    FileConnection fileConn = (FileConnection)Connector.open("file:///root1/" fileName, Connector.READ);
    if(!fileConn.exists())
    System.out.println("File not found");
    else
    System.out.println("File opened");
    /**************************************CODE***********************************/
    I always get the o/p as "File Not Found" although there exists a .txt file in the directory /root1. What is to be done to open file on emulator? Please give suggestions...
    Message was edited by:
    Chintan.Kanal
    Message was edited by:
    Chintan.Kanal

    i m not sure but i hope this one is right 4 u......
    StringBuffer buff = new StringBuffer();
    InputStream istr = getClass().getResourceAsStream("/CLM.txt");
    for(int i=0 ; ; i++) {
    try {
    if(istr != null) {
    someByte = istr.read();
    if(someByte == -1) {
    buff.append("*");
    clmcontent = buff.toString();
    break;
    buff.append((char)someByte);
    } else {
    // do some necessary
    } catch(IOException ioe) {
    }

  • Mystery open network

    I'm using an airport extreme as an access point with two windows computers.  I set up only one network and made it secure.  But windows is listing a second network, which is not secured, called Apple Network x2c986 (characters changed for security purposes). This open network is not listed in the airport utility. I'd like to know what it is and how to secure it.
    My network is physically configured like this:
    cable modem <-> apple airport extreme (ethernet).
    AAE <-> WinXP laptop (ethernet)
    AAE <->WinXP laptop <-> Windows 7 laptop (wireless)
    The secure network has wpa2-personal security, aes encryption and a security key. The Apple network has none of these. I can apply wpa2-personal security, aes encryption and the security key in the Windows securitiy properties window, but  what am I securing and can doing so mess up my network?
    Thanks for any help.
    Ellen

    But windows is listing a second network, which is not secured, called Apple Network x2c986
    This is one of two things:
    1) Another user near you has an Apple device that they have not set up yet. Normally, you would "see" the device in AirPort Utility if you connect to the network.  Is that the case? Can you connect to this network?  If yes, best to leave well enough alone. Someone is foolish enough to leave their network open and use default names for their network.
    2) Apple routers use the Apple Network xxxxxx network name to set up the device using wireless. This might have been your AirPort device and the computer is "remembering" the old previous connection. If you try to connect to the this network, but nothing happens, then this is the default network that your device produced before you configured it.

Maybe you are looking for

  • EJB QL on oc4j 10.0.3

    Hi, I have a problem with an EJB QL query on oc4j 10g using toplink persistance manager. The Query is: SELECT OBJECT(h) FROM AirportZoneBean AS h WHERE (?1 BETWEEN h.lowerLeft_x AND h.upperRight_x) AND (?2 BETWEEN h.lowerLeft_y AND h.upperRight_y) Wh

  • Embedding html in xml tags, when rednering text as html

    Quick question, I have a site that reads all content from an external xml. The text box that reads this info renders the content as html; does anyone know how to go about putting an html tag in an xml tag so that flash can read it? So would it be pos

  • What software can replace iWeb since it is not supported on Lion?

    I had to buy a new MacBook Pro.  Mine was stolen.  I had used iWeb on my last MacBook Pro to set up a website for my business.  I therefore do not have access to iWeb and Lion doesn't support it. What app or software will let me work with my existing

  • What's the best foto editing for eBay pictures?

    Hi I take digital photos of eBay items I'm sellling, then transfer them into iPhoto v 5.04. I then immediately export them into my Picture folder using iPhoto's "Export Photo" "File Export" defaults: JPG, Full-size images, Use Filename, Use extension

  • HT1386 my i phone can't detect to the pc

    why does my i phone can't detect on my computer?!