×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    2

    Nokia 6280. (StreamConnection)Connector.open waits forever.

    I did a simple application to connect to custom server by port 6010. When application executes "(StreamConnection)Connector.open("socket://xxx.xxx.xxx.xxx:6010" , app waits forever. The application is hanged in this sentence. ¿What can i do?

    I tried to certificate the application (.jar and .jad) but i dont know to install a custom certificate in nokia 6280.

    Please help me !!!!
    bye

  2. #2
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: Nokia 6280. (StreamConnection)Connector.open waits forever.

    hi,

    have you tried Nokia sample (Midlet+server side) to test if it works fine on that device?
    http://www.forum.nokia.com/info/sw.n..._v1_0.zip.html

    signing is required for ports 80/443/8080 in MIDP 2.0 security for socket connections only if I remember well,

    regards,
    peter

  3. #3
    Registered User
    Join Date
    Aug 2006
    Posts
    2

    Re: Nokia 6280. (StreamConnection)Connector.open waits forever.

    Hello Peter !!!!
    To execute the sample of Nokia i must install many software.
    It's complicated. It's very easy the problem.

    In Nokia 6230 works fine the sentence "(StreamConnection)Connector.open("socket://xxx.xxx.xxx.xxx:6010")". In nokia 6280 not works.

    I have proved with MIDP2.0 "(SocketConnection)Connector.open("socket://xxx.xxx.xxx.xxx:6010")" and happens the same.

    The source code is:

    /***************************************/

    /*
    * HelloMidlet.java
    *
    * Created on 1 de agosto de 2006, 9:54
    */

    package hello;

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

    /**
    *
    * @author admin
    */
    public class HelloMidlet extends MIDlet implements CommandListener {


    /** Creates a new instance of HelloMidlet */
    public HelloMidlet() {
    }

    private Command exitCommand;
    private List list1;
    private Command Connect;
    private Command Disconnect;
    private StreamConnection websock;


    private void connect()
    {
    try {
    websock = (StreamConnection)Connector.open("socket://213.98.161.86:6010",Connector.READ_WRITE,false);
    this.get_list1().append("Connect OK",null);
    }
    catch (Exception e)
    {
    this.get_list1().append(e.toString(),null);
    }
    }

    private void disconnect()
    {
    try {
    if (websock != null) {
    websock.close();
    }
    websock = null;

    } catch (Exception e) {
    //e.printStackTrace();
    }
    }


    /** This method initializes UI of the application.
    */
    private void initialize() {
    // Insert pre-init code here
    getDisplay().setCurrent(get_list1());
    // Insert post-init code here
    }

    /** Called by the system to indicate that a command has been invoked on a particular displayable.
    * @param command the Command that ws invoked
    * @param displayable the Displayable on which the command was invoked
    */
    public void commandAction(Command command, Displayable displayable) {
    // Insert global pre-action code here
    if (displayable == list1) {
    if (command == Connect) {
    // Insert pre-action code here
    this.connect();
    // Do nothing
    // Insert post-action code here
    } else if (command == Disconnect) {
    // Insert pre-action code here
    this.disconnect();
    // Do nothing
    // Insert post-action code here
    } else if (command == exitCommand) {
    // Insert pre-action code here
    exitMIDlet();
    // Insert post-action code here
    }
    }
    // Insert global post-action code here
    }

    /**
    * This method should return an instance of the display.
    */
    public Display getDisplay() {
    return Display.getDisplay(this);
    }

    /**
    * This method should exit the midlet.
    */
    public void exitMIDlet() {
    getDisplay().setCurrent(null);
    destroyApp(true);
    notifyDestroyed();
    }



    /** This method returns instance for exitCommand component and should be called instead of accessing exitCommand field directly.
    * @return Instance for exitCommand component
    */
    public Command get_exitCommand() {
    if (exitCommand == null) {
    // Insert pre-init code here
    exitCommand = new Command("Exit", Command.EXIT, 1);
    // Insert post-init code here
    }
    return exitCommand;
    }

    /** This method returns instance for list1 component and should be called instead of accessing list1 field directly.
    * @return Instance for list1 component
    */
    public List get_list1() {
    if (list1 == null) {
    // Insert pre-init code here
    list1 = new List(null, Choice.IMPLICIT, new String[0], new Image[0]);
    list1.addCommand(get_Connect());
    list1.addCommand(get_Disconnect());
    list1.addCommand(get_exitCommand());
    list1.setCommandListener(this);
    list1.setSelectedFlags(new boolean[0]);
    // Insert post-init code here
    }
    return list1;
    }

    /** This method returns instance for Connect component and should be called instead of accessing Connect field directly.
    * @return Instance for Connect component
    */
    public Command get_Connect() {
    if (Connect == null) {
    // Insert pre-init code here
    Connect = new Command("Connect", Command.OK, 1);
    // Insert post-init code here
    }
    return Connect;
    }

    /** This method returns instance for Disconnect component and should be called instead of accessing Disconnect field directly.
    * @return Instance for Disconnect component
    */
    public Command get_Disconnect() {
    if (Disconnect == null) {
    // Insert pre-init code here
    Disconnect = new Command("Disconnect", Command.OK, 1);
    // Insert post-init code here
    }
    return Disconnect;
    }

    public void startApp() {
    initialize();
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    }


    /***************************************/

    Thanks a lot Peter !!!!

  4. #4
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: Nokia 6280. (StreamConnection)Connector.open waits forever.

    hi,

    ok, now its seems clear:
    The application is hanged in this sentence
    you need to run any io method in separate thread otherwise your midlet will hang,
    follow basic tutorials about that:
    http://developers.sun.com/techtopics...ing/index.html
    http://java.sun.com/developer/J2METe...01/tt0917.html

    or just follow any Nokia sample jad/jar sources that ships with Nokia SDK, all have threading for network connections implemented,

    hth,
    regards,
    Peter

Similar Threads

  1. Replies: 2
    Last Post: 2008-04-03, 19:02
  2. Nokia User Agent Header
    By rajendrap16 in forum Browsing and Mark-ups
    Replies: 17
    Last Post: 2008-02-24, 15:43
  3. Regarding Nokia 3120 GPRS features
    By idiotkid in forum Wired and Wireless interfaces (Closed)
    Replies: 1
    Last Post: 2006-11-30, 18:37
  4. which phones for laptop
    By dvdljns in forum PC Suite API and PC Connectivity SDK
    Replies: 2
    Last Post: 2006-02-14, 12:58
  5. Infra-red capability
    By Symbian_Challenge_0412 in forum General Development Questions
    Replies: 1
    Last Post: 2005-08-16, 18:24

Posting Permissions

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