Maintenance of the Socket connections alive

Hello developers,

Please, I have problems to perpetuate a socket connection in my application for a long time. It seems to disconnect after a short (2 minutes) while especially if he's inactive.

It happens that I have write an application with a Chat feature and for that, that I keep a socket connection Alive for the life - tme of my application. I tried stuff like Ping Server every minute, but then this is a leak of resources (Blackberry). Push BlackBerry is not an option (as I have other clients other than BB devices).

Please someone know how I can fix this or suggest a different way to go about this?

I agree with previos answering machine. The problem you have is push RIM invented.  I'm not aware of a way around that. If you cannot use the pusher, then you will have to keep alive and if your app will suffer battery drain and possibly additional costs related to data traffic.

Some people have used email instead of push as a wau to notify the application that there is something to it: this requires a listener e-mail in the application process and eliminate these notification emails.

If you do not use a living message of keep, then I think this quesiton becomes useless:

«How I even the difference between blackberry...» »

Tags: BlackBerry Developers

Similar Questions

  • I have a problem when you try to receive data using the socket connection.

    Hello

    I created a socket connection between a pc (sever, win32) and a blackberry (client) and I have only two questions:

    -When I send a string to the sever I get the unexpected result, I doubt if it's a problem of encoding between platforms.

    -When I try to receive data, (an array of char as a string object), the customer demand freeze (drawing and management of events, so basically the main UI thread), even if I did all the stuff of connection in a separate thread, until I have shut down the server and also no data is received.

    I left the codes below and would assess any response from you.

    C++, win32 console application:

    SOCKET _Socket;

    int _tmain (int argc, _TCHAR * argv)

    {

    If (start_sever (_socket)) {}

    char r_msg [26];

    recv (_socket, r_msg, 26, 0);

    std::cout< "receive="" :="" "="">< r_msg=""><>

    char * s_msg customer = 'welcome ';

    Send (_socket, szMessage, strlen (S_MSG), 0);

    std::cout< "send="" :="" "="">< s_msg=""><>

    Sleep (500);

    Shutdown (_socket, SD_SEND);

    closesocket (_socket);

    WSACleanup();

    } else {}

    std::cout< "cannot="" initialize="">< std::endl="">

    }

    System ("pause");

    return 0;

    }

    BOOL start_sever (socket) {}

    WSADATA WsaDat;

    If (WSAStartup (MAKEWORD (2.2) & WsaDat)! = 0)

    {

    std::cout<"WSA initialization="">

    WSACleanup();

    System ("pause");

    Returns false;

    }

    Socket = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);

    if(Socket==INVALID_SOCKET)

    {

    std::cout<"Socket creation="">

    WSACleanup();

    System ("pause");

    Returns false;

    }

    SOCKADDR_IN serverInf;

    serverInf.sin_family = AF_INET;

    serverInf.sin_addr.s_addr = INADDR_ANY;

    serverInf.sin_port = htons (8888);

    If (bind (Socket,(sockaddr*) (& serverInf), sizeof (serverInf)) == SOCKET_ERROR)

    {

    std::cout<"Unable to="" bind="">

    WSACleanup();

    System ("pause");

    Returns false;

    }

    Listen(Socket,1);

    SOCKET TempSock = SOCKET_ERROR;

    std::cout< "build="">

    while(TempSock==SOCKET_ERROR)

    {

    std::cout<"Waiting for="" incoming="">

    TempSock = accept (Socket, NULL, NULL);

    }

    Socket = TempSock;

    std::cout<"Client>

    Returns true;

    }

    Platform of Java for blackberry:

    public class Bush extends form {}

    -my current ipv4 address is set by default to avoid reset at each test

    TextField ip_text_field = new TextField ("IP address:", "192.168.65.1");

    -the server is waiting for any connection to this port ("8888")

    TextField port_text_field = new TextField ("Port:", "8888");

    ButtonField go_button_field = new ButtonField ("Connect", Field.FIELD_HCENTER) {}

    protected Boolean invokeAction (int action) {}

    UiApplication.getUiApplication () .invokeLater (new Runnable() {}

    public void run() {}

    try {

    open_connection();

    }catch (System.Exception e) {}

    e.printStackTrace ();

    Dialog.Alert (e.getMessage ());

    }

    }

    });

    return true;

    }

    };

    public Socket() {}

    Super ();

    setTitle ("[taking sample]");

    Add (ip_text_field); ip_text_field.setMargin (20, 0, 0, 0);

    Add (port_text_field); port_text_field.setMargin (30, 0, 0, 0);

    Add (go_button_field); go_button_field.setMargin (30, 0, 0, 0);

    }

    public Boolean onClose() {}

    this. close();

    return true;

    }

    _Con StreamConnection;

    DataInputStream _in;

    OutputStreamWriter _out;

    public Sub open_connection() throws Exception {}

    _CON = (StreamConnection) Connector.open ("socket: / /" + ip_text_field.getText () + ":" + port_text_field.getText () +)

    » ; deviceside = true; interface = wifi");

    this.add (new TextField ("", "connected successfully to Server"));

    _in = _con.openDataInputStream ();

    _out = new OutputStreamWriter (_con.openDataOutputStream ());

    String msg = "Welcome to customer \r\n";

    _out. Write (MSG);

    String r_msg = _in.readUTF ();

    this.add (new TextField ("read from sever:", r_msg));

    _out. Flush();

    _in. Close();

    _out. Close();

    _CON. Close();

    this.add (new TextField ("", "data has been changed"));

    }

    }

    Thanks for your help.

    You treat on the thread of events.

    You have the following code:

    UiApplication.getUiApplication () .invokeLater (new Runnable() {}

    public void run() {}

    try {

    open_connection();

    .....

    Now invokeLater essentially tells the operating system that the associated executable must be run on the event Thread.  You need start a separate Thread.  Extend this Thread, add your code in the run() method, and then start the Thread with start(). (not run()).  Then you must run the networking of processing on a separate Thread.

    This will cause you problems updating the user interface.  Take a look at this help:

    http://supportforums.BlackBerry.com/T5/Java-development/update-a-screen-on-the-main-event-thread/TA-...

    Printing, this means that invokelater a separate Thread is a common misconception.  I recommend you to look at this:

    http://supportforums.BlackBerry.com/T5/Java-development/what-is-the-event-thread/Ta-p/446865

    In addition, I recommend that you take a look at the socketDemo which must be included as a sample-, otherwise you can find it on github:

    https://github.com/BlackBerry/JDE-samples

  • java.security.AccessControlException on the socket connection

    Hi all

    I'm java.security.AccessControlException on open socket connection, I added permissions API, looks like I missed something.

    SocketConnection sc = null;

    try {}

    SC = (SocketConnection)

    Connector.Open ("socket://10.91.40.120:1883"); ")

    } catch (IOException ex) {}

    Logger.getLogger (NetworkAPI.class.getName ()) .log (Level.SEVERE, null, ex);

    }

    APIpermissions.jpg

    Hello

    You need javax.microedition.io.SocketProtocolPermission to access socket connection.

    Please add the following permissions to the project:

    -client connection: javax.microedition.io.SocketProtocolPermission "socket / / *: *:

    -Server connection javax.microedition.io.SocketProtocolPermission "socket / /: *:

    Concerning

    Alexey

  • Problems with the socket connection

    Hello

    I am trying to connect to socket between blackberry and pc Simulator, so that blackberry and pc can talk back.

    However, I found that only the first data sent from blackberry can be received by server successfully.

    When the server tries to turn the blackberry, he failed.  (Survey net.rim.device.cldc.io.ippp.SocketBaseIOException: Connection Timed Out)

    And the blackberry cannot send data to the server successfully.

    I am using BlackBerry MDS Services and write the customer after the demonstration ConnectThread.

    String url = "socket: / /" + socketServer + ":" + socketPort + "; deviceside = false;
    connection = (StreamConnection) Connector.open (url);

    Can help any one on this? Thank you!

    I tested the SocketDemo with completely the example code, server and client.

    In fact, it should be the same problem with this thread,

    http://supportforums.BlackBerry.com/T5/Java-development/another-socket-problem-socket-is-not-receivi...

    My own app can work very well after replacing InputStreamReader InputStream...

  • refuse the socket connection in the first leg of an application

    Hello

    I have an application that connects with the server (SSL, but the same thing happens when you're a normal socket).

    When I load my application for bb and run it for the first time, I have an alert asking if I want to trust connection socket/ssl (this alert is only for the first execution of an application). When I deny it, there is no possibility to run this application! each connection test is successful again! everything is on 'allow' in-> modules-> apply-> permissions.

    Why is it like that? and how can I solve this problem?

    As well as all the permits various, the BB has a 'Firewall' which will block or allow access to different URLS.  To get the application will, all you need to do is to reset the Firewall setting.  However, I'm not aware of being able to do this either from within a program, or to be able to do that for a specific URL.  Unlike most PC firewall, if you get an incorrect setting, you must reset the firewall that clears all entries, then you will be asked again.

    You will find the firewall on the Options--> Security Options > Firewall - then use this menu to 'Reset settings' (note that getting to the firewall mode between levels of BONE, it is OS 4.6)

  • How to create the socket under proxy connection?

    Hello world

    I am creating the socket under proxy connection connection, it isn't working and I put the MDS proxy setting and I am able to create the http connection, but it gives me the error 'Connection refused' when I try the socket connection, so please any body have any idea please help me do this.

    Thanks to advanced

    Tita

    Hello

    peter_strange thank you very much for your support. Kudo for your.

    I found the solution to my old thread. Please see for the answer http//www.answer

  • in the waking state socket connection problem

    Hi all.
    My app need update real-time security data, it should be able to run well even the switch of the PB in the waking state.
    The problem is that when PB passes to the waking state and more than an hour later, my application cannot send request for data to the socket server (initially he workd well), even when the PB get again enabled, the socket connection is also unnecessary.
    I did a test as follows:
    1, I added the "throttled" in the blackberry - tablet.xml
    2. I have add a few listiner event in the main class, but each of them can be fired in any time.

    QNXSystem.system.addEventListener(qnx.events.QNXSystemEvent.STANDBY,onDeactive);
    QNXSystem.system.addEventListener(qnx.events.QNXSystemEvent.ACTIVE,onActive);
    QNXSystem.system.requestResource(QNXSystemResource.NETWORKING);
    stage.addEventListener(Event.USER_IDLE,userIdle);
    stage.addEventListener(Event.USER_PRESENT,userPresent);
    stage.addEventListener(Event.ACTIVATE,onStageActive);
    stage.addEventListener(Event.DEACTIVATE,onStageDeactive);
    

    3, I put a clock to save information in / shared folder.it worked well in the waking state.

    Thanks for any response.

    Hello.
    I'm a developer of instant messaging which is connected to the door via socket. What I can tell you for sure I you need to use:
    normal
    That, to use SocketMonitor to ensure that connections are available, some WiFi routers can close idle connection event when U don't want to! If you need to reconnect in such cases.
    Please, feel free to ask for help more.

  • No Socket connection avaialbel

    Hello

    I met a strange on a BB (8820 OS 4.5 AT & T) behaviour when I tried to open the socket connection:

    I disconnected the WIFI device and then tried to open the socket of my application in several ways but non of them works even if I managed to browse the internet (GPRS is shown on main Ribbon of BB).

    I tried to use the following suffixes:

    (1); deviceside = false (for BES connection type)

    (2); deviceside = true (for direct TCP connection type)

    (3); deviceside = true; interface = Wi - Fi (for direct TCP connection with WLAN type)

    I checked the correct APN settings (same as written in 3 different sites) on the BB, but I keep getting error messages such as: timeout 120 sec, invalid tunnel name. When WIFI is connected to the socket is opened successfully and works, but without it, nothing happens.

    Another test I did, I read the link: http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

    and tried to add the UID WAP2, I found in the device but I still have the connection timeout.

    Is there a way I can connect without WIFI in such situation?

    I discovered that I used the WAP2 incorrectly so that there was a valid WAP2 entry in full book

    I used it incorrectly and causing the failure of the connections.

  • Problem of test Signal before using the TCP connection

    Right now my application uses a SocketConnection TCP to communicate with a remote server.  It works fine, but I'm trying to make sure that my program can correctly handle the situation to move to an area with no coverage.

    When I run my application, if I uncheck the box "on the cover" for GSM and CDMA under Network properties, my app fine until it calls the OutputStreamWriter.write () function to send something on the socket connection.  I have it in a try/catch block, but it just seems to hang instead of throwing an exception.

    How can I check the signal before attempting to send data on the SocketConnection?

    To facilitate clear life upwards, here's the order of what happens:

    1 application starts on the cover.

    2 SocketConnection made successfully.

    3 OutputStreamWriter successfully SocketConnection.

    4. coverage is lost

    5 OutputStreamWriter.write () is called, but freezes instead of throwing an exception.

    The socket connection output stream write operations do not throw an exception when there is no coverage is the correct behavior. That's because on cellular networks the IP tunnel to the carrier (and therefore the TCP connections on this tunnel) survives loss of coverage. For example, if your application opens a connection TCP from a BlackBerry, then the BlackBerry loses coverage, then take cover, say, 1 minute later, the TCP connection opened by your application will continue works fine, unless intermediate network component or your server closes the connection due to inactivity.

  • socket connection - a reward for $30

    I am building an application that uses the socket connection. When the application runs, my desktop, it works fine, however when it is running on a remote server, I get the security sandbox violation: "cannot load data from serverName.com:portNumber."

    There is another application on the Adobe (posted by Josh Tynjala) lab that people have the same problem: http://www.zeuslabs.us/archives/6/connecting-to-aim-with-actionscript-3-sockets/

    Josh's response was: "you need to run the SWF to a location on your computer."

    Its application works well at the local level, but when I upload it to a remote server, I get: "cannot load data from aimexpress.oscar.aol.com:5190." Is it possible to get the socket connection to work on a remote server and not only on the desktop?

    I'll give you $30 (using western union or paypal) if someone can get Josh Tynjala application to work on the remote server.

    The file XML cross was placed in the wrong place, it works fine now.

  • Get a connection error 421 4.4.2 dropped due to the socket error in exchange 2010

    We get an error while sending an e-mail to a particular connection 421 4.4.2 abandoned due to the socket error in exchange 2010

    Hi jussainkothari_412,

    Thanks for posting your question in the Microsoft answers Forum. Any questions on Exchange, please visit the following link:

    http://social.technet.Microsoft.com/forums/en-us/category/ExchangeServer/

  • DRAC5 "Error when reading the SSL socket connection"?

    Hello

    I have a BIOS of PowerEdge 1950 2.7.0 with DRAC 5 Firmware Version 1.65 (12.08.16).

    When you try to connect to 'Console' I get the error "Error when reading the SSL socket connection".

    I spoke the line "# jdk.tls.disabledAlgorithms = SSLv3, RC4, MD5withRSA, DH keySize.< 768"="" at java.security="" file="" but="" still="" the="">

    I use WIndows 10 with the latest FireFox.

    Thanks in advance,

    Asaf

    I found that these changes were necessary to connect to the DRAC 5 using Chrome and Java 8, rev card. 91:

    In Control Panel > Java > Security:

    1. check "Enable content of java in the browser.

    2. set the security level to "High".

    3. Add each DRAC IP to the list of exceptions

    In C:\Program Files (x86)\Java\jre1.8.0_91\lib\security\java.security):

    Remove MD5:

    jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024
    

    Remove SSLv3, RC4 and MD5withRSA:

    jdk.tls.disabledAlgorithms=DH keySize < 768
    
  • Socket connection in the Simulator with MDS, but not on the curve

    Hello

    Working on an application using socket connections.

    SOC = (SocketConnectionEnhanced) Connector.open ("socket: / /" + address.ip_number + ":" + address.port_number + ";") deviceside = true");

    Proceed to use a DataInputStream and DataOutputStream to communicate.

    The server works, can transmit very well with the Simulator, but also another curve (not same model). (There is a small chance that deviceside = true has not been passed as a parameter when we tested on the curve, which would go through BES? This is probably still there however).

    IMHO, this means the places that the question could be one) how the code is implemented on the client phone or b) phones or their settings (have 4 curve 8530 s on the same CDMA network).

    -These phones have already activated in the last days, is there the chances that something is missing from the service book to allow socket connections? (I doubt that what I downloaded messenger ping I assume uses taken... and everything is fine).

    No authorization application that I put?

    Ideas! Please let your mind flow. Thank you!

    To all those who might find this thread after encountering the same problem:

    The issue was with the DataInputStream... available() was ALWAYS return zero, even if there are more bytes to read. This is our 8530 s curve 4 tests phones. Tried on another curve and "BOLD" and they did not have this problem.

    Use available() stopped and tried reading for much bigger than one of our packages will be (5000 bytes).

    Have some phones to test with 5.0.0.337 that they would not work with that.

    After the 5.0.0.1000 they all work perfectly.

    I read somewhere that the available() issue has to do with J2SE-> J2ME problems, something on a wrapper. This problem exists (or existed) with TSL/SSL apparently (sorry I can't find the thread I get this info, if someone really wants to see him answer and I'll get the link in the history of my browser of laptops).

    Hope this helps someone!

    B

  • Maintenance mode, unable to connect: 514 error connection to the instance of service pass vmds

    Hi all

    I do a few patches manually on ESX 4.0 host.  I forgot to get into maintenance mode, tried to patch and had an error on entering maintenance mode.  So I tried to get into the mode of maintenance with the following command:

    vimsh - n hostsvc/e/maintenance_mode_enter

    I get these messages:

    Current working directory: / root

    vmaCore: initSSL: make versionCheck = true

    handshake Timeout = 20000000

    Unable to connect: 514 error to connect to the instance of the service host-vmds

    Not connected

    Not connected

    Someone has ideas of what happens and how to solve?

    Thank you.

    Take a look at reboot on an ESX or ESXi Server management agents and VMware: hanging out on an ESX Server maintenance mode (9639912)

  • Socket connection WebCenter portal to the WebCenter content error

    I'm trying to connect WebCenter Portal 11.1.1.6 to WebCenter content and I get the following error in my log of the Complutense University of MADRID:

    [< 12 may 2012 2:32:12 PM CDT > < error > < Socket > < BEA-000403 > < IOException occurred in the socket: Socket[addr=/192.168.106.19,port=52721,localport=16200]
    java.net.SocketException: recv failed: descriptor not a socket.
    java.net.SocketException: recv failed: descriptor not a socket
    at jrockit.net.SocketNativeIO.readBytesPinned (Native Method)
    at jrockit.net.SocketNativeIO.socketRead(SocketNativeIO.java:32)
    at java.net.SocketInputStream.socketRead0 (SocketInputStream.java)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at weblogic.socket.SocketMuxer.readFromSocket(SocketMuxer.java:988)
    Truncated. check the log file full stacktrace
    >

    I followed the instructions to activate the Folders_g and all these other quirks, but it still does not. Here is my file config.cfg:

    <? jcharset cfg = "Cp1252"? >
    Properties of the #Server system
    IDC_Name = webctr_4444
    IdcProductName = idccs
    InstanceMenuLabel = webctr_4444
    InstanceDescription = Instance webctr_4444
    SocketHostAddressSecurityFilter=192.168.106.19|127.0.0.1|0.0.0.0.0.0.0.1

    Variable #Database
    SystemDatabase:DataSource = CSD
    SystemDatabase:UseDataSource = true

    Variable #Internet
    HttpServerAddress = webctr.domain .net: 16200
    Mail = mail server
    [email protected]
    HttpRelativeWebRoot = / cs /.
    UseSSL = No

    #General option Variables
    IsAutoNumber = Yes
    AutoNumberPrefix = webctr_4444
    UseAccounts = 1

    Variable #Additional
    AllowUpdateForGenwww = 1
    registerStartMenuActions = 1
    FileEncoding = UTF8
    Web server = javaAppServer
    IDC_ID = IpmNode
    FsAutoConfigure = true
    IntradocServerPort = 4444


    And my settings in WebCenter for the connection of content repository:

    Content administrator: weblogic
    Root folder: /content
    Application name: PortalContent

    RIDC Type of Socket: Socket
    Host: webctr.domain.net
    Server port: 16200
    Timeout: 300
    Authentication method: identity Propagation
    The root of context Server Web site: /cs/
    Administrator username: weblogic
    Administrator password: < disabled >


    Any ideas that I might be missing? I tried to reboot several times.

    Published by: dvmorris on May 12, 2012 12:41

    You try to connect using the web port.
    A socket connection uses RIDC, which means you need to use the port of intradoc which 4444 in your case.
    So to change the port number in your connection to 4444 and it should work.

Maybe you are looking for

  • iPhone 6 s - ios 9.3.3 - apps are missing or hidden and does not refresh

    After the recent update my iphone 6s 9.3.3 will expose a strange behavior with the management of the app. -Apps have disappeared but app store think they are always installed -For missing applications, the 'Open' button will be grayed out when I sear

  • How can add other software to my design

    Dear engineer I need to add another software for my design of labview. I want this other software for binding in the my design of labview. How can I add another software for my design of labview. Please help me on this problem. Thank you & best regar

  • HP Officejet Pro 8600 Plus do not print hardcover

    I tried the solutions posted: 1) made sure the tray 2 is not installed. (2) printed 100 white pages of plain paper. (3) modified preference hardcover and paper media.  However, I always get out of paper message when you try to print on thick paper. T

  • Fell on the ground and do not work

    Nice day... I have laptop HP Pavilion m6-1060ee, product: B6H83EA #ABV, S/N: [personal information deleted]. At the end of my work day, I put the laptop in the bag, and he fell to the floor of 90 cm high (3f), when I strted it again once the power an

  • HP Laser Color CM1312nfiMFP

    The printer does not work, but there is that some start noise, the display is always white, there is no LED anywhere, anytime and the scanner does not work. Woul you please give me help.  Thank you