H_Dev's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
11 (0.02 per day)
Joined:
25-January 13
Profile Views:
1,136
Last Active:
User is offline Mar 08 2013 12:44 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   H_Dev has not set their status

Posts I've Made

  1. In Topic: RFCOMM client can't reconnect to server

    Posted 2 Feb 2013

    Quote

    Just to note- flushing your Writer will occur when you close it, and you can't flush() after closing.


    As i understand you, we can not flush() after closing. Am i right?

    I was change my code and seem to work properly.
    if(writer != null)
    {
        try
        {
            writer.flush();
            writer.close();
            main.label1.setText("writer was closed");
        }
        catch (IOException ex)
        { 
            main.label1.setText("writer stay opened : " + ex.toString());
            ex.printStackTrace();
        }
    }
    
    

    And the result is
    writer was closed
    


    Now all my connection seem to be closed, and i can reconnect again to the server even if i not close my midlet.

    But when i close and reopen my midlet (on third time), i still get exceptions :
    javax.bluetooth.BluetoothConnectionException: Can not create RFCOMM connection
    

    Why ?
    I would like to try to connect to my server via my emulator but i can't find reference for that.
    I use NetBeans 7.1

    Sorry for my long questions. Thanks in advanced.
  2. In Topic: RFCOMM client can't reconnect to server

    Posted 31 Jan 2013

    I am so sorry for that.

    Quote

    Let's do a little debugging. Are you sure you closed your Connection? Has anything been left open (a Writer, a Connection, etc.) when you move away from the app?


    Thank you so much macosxnerd101 for you remain me do a little debugging.
    I was insert some code to see the state of my connection after try to disconnecting my connection and before my midlet closed.
    these are the result:
    writer stay opened
    input was closed
    output was closed
    connection was closed
    
    

    I was try to move the
        if(writer != null)
        {
            try
            {
                writer.close();
                writer.flush();
            }
            catch (IOException ex)
            { 
            }
        }
    
    

    after closing input and output. But StreamWriter stay left opened. And so i try to interupt the thread and the result does not changed.

    how should i closing the StreamWriter?
    Sorry for my english.
    Thanks in advanced.
  3. In Topic: RFCOMM client can't reconnect to server

    Posted 28 Jan 2013

    :surrender: :helpsmilie:
  4. In Topic: RFCOMM client can't reconnect to server

    Posted 27 Jan 2013

    Okay, my exeptions above are when i run my app on emulator. Thats exceptions occured because (may be) my emulator can't access bluetooth on my computer.

    If i run the app on my phone, i get this Exception :
    
    javax.bluetooth.BluetoothConnectionException: Can not create RFCOMM connection
    
    
    

    please help
  5. In Topic: RFCOMM client can't reconnect to server

    Posted 27 Jan 2013

    Thanks a lot macosxnerd101, after put printStackTrace() i got this on my emulator :
    javax.bluetooth.BluetoothConnectionException: IO error in btspp::connect\n
    	at com.sun.jsr082.bluetooth.btspp.BTSPPConnectionImpl.doOpen(), bci=80
    	at com.sun.jsr082.bluetooth.btspp.BTSPPConnectionImpl.<init>(), bci=59
    	at com.sun.jsr082.bluetooth.btspp.BTSPPConnectionImpl.<init>(), bci=4
    	at com.sun.jsr082.bluetooth.btspp.Protocol.clientConnection(), bci=19
    	at com.sun.jsr082.bluetooth.BluetoothProtocol.openPrimImpl(), bci=52
    	at com.sun.jsr082.bluetooth.BluetoothProtocol.openPrim(), bci=11
    	at com.sun.midp.io.j2me.btspp.Protocol.openPrim(), bci=4
    	at javax.microedition.io.Connector.open(), bci=47
     - way.connect(way.java:86)
     - way.run(way.java:43)
    	at java.lang.Thread.run(Thread.java:721)
    
    

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

H_Dev hasn't added any friends yet.

Comments

H_Dev has no profile comments yet. Why not say hello?