Http connection hangup

I use 4.5.7 JDE and the Simulator for the device of 8300.  I have code very similar to that of the API for opening an http connection and sends the data using the connection.  The code is below:

Try
{
c = (HttpConnection) Connector.open (url);
           
Define the headers and the request method
c.setRequestMethod (HttpConnection.POST);
           
Get the output stream may be empty headers
OS = c.openOutputStream ();
OS. Write ((pMessage + ""). getBytes());
OS. Flush();           As an option, will be served getResponseCode

Get the response code is open the connection,
Send the request and read HTTP response headers.
The headers are stored until asked.
RC = c.getResponseCode ();
If (rc! = HttpConnection.HTTP_OK) {}
throw new IOException ("* HTTP response code:" + rc);
}
}

I'm performing a few tests and it works very well if the server side, it connects to runs, but when I test what happens if the server must be down and then it crashes on the declaration of os.flush and I never regain control.  If I remove the flush that is optional, then it crashes on the getResponseCode statement.  How can I prevent hang on the flush, if the server should be down?

Is there a way to check the viability of the connection before performing the flush?

Thank you

See this Article for more details:

How - to control the timeout for TCP connections via BlackBerry Mobile data system connection Service
Article number: DB-00526
http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/How_To _...

Tags: BlackBerry Developers

Similar Questions

  • Items that are unencrypted in a https connection may be hidden?

    For a long time, IE was an option to hide items unencrypted in a https connection. I can't find such an option now, so I can't give more details. BU is the point: Firefox can do? Some sites have encrypted partially connections and for me it is important to distuinguish what is safe and what is not in these sites. A sad example is very support page for the product Mozilla (see below).

    Thanks in advance.

    You can still file an enhancement request in Bugzilla (or) - http://bugzilla.mozilla.org
    Try it, I really encourage you to follow this path.

  • I get an error pop-up that says that Web page contains content that is not delivered using a secure HTTPS connection. What does that mean?

    I get an error pop-up that says that Web page contains content that is not delivered using a secure HTTPS connection, but likely to compromise the security of the entire webpage, whatever that means

    In "BOLD" on the very top of the ther security warning she also ask you want to view only the webpage content that was delivered safely?

    original title: HTTPS connection issues

    You are using Internet Explorer 8?

    This article describes the causes of this message and how you can remove:

    http://blogs.msdn.com/b/ieinternals/archive/2009/06/22/HTTPS-mixed-content-in-IE8.aspx

    Information on the changes in Internet Explorer 9 is available here:

    http://blogs.msdn.com/b/ie/archive/2011/06/23/Internet-Explorer-9-security-part-4-protecting-consumers-from-malicious-mixed-content.aspx

  • How can I configure computer mi to ACCEP https connection

    How can I configure computer mi to ACCEP https connection

    original title: my device does not accept the connection of the https port, I have Windows vista

    Hi, Rosariopenaranda,

    Do you get any error Messages?

    Tools > Internet Options > Advanced tab

    Scroll down to the Section navigation

    Uncheck Show friendly https error messages

    Click on apply, Ok

    Tools > Internet Options > Connections tab

    Click the Lan settings button

    Check automatically detect settings

    Click Ok, apply, Ok

    Change proxy settings in Internet Explorer

    http://Windows.Microsoft.com/en-us/Windows-Vista/change-proxy-settings-in-Internet-Explorer

    HOW to: Use Wfetch.exe to troubleshoot HTTP connections

    http://support.Microsoft.com/kb/284285

  • "Do you want to view only the webpage content that was delivered safely. "the Web page content that willl be sent using a secure HTTPS connection, which could jeopardize the securityof the entire Web page.

    Original title: SECURITY WARNING

    When I try to open a program I have getthis message:

    "Do you want to view only the webpage content that was delivered safely.

    "the Web page content that willl be sent using a secure HTTPS connection, which could jeopardize the securityof the entire Web page.

    Is this something that needs to be corrected?  If yes how.

    Hi billkabay,

    (1) program which you are referring?

    (2) is the problem confined to this specific programme?

    (3) since when are you facing this problem?

    This problem normally occurs when you open Web pages in internet explore. Please specify if this happens when you open a program or opening a Web page or link in internet explore.

    You can see the steps in the link below

    https://community.dynamics.com/product/crm/crmtechnical/b/crminogic/archive/2009/07/09/how-to-disable-the-34-do-you-want-to-view-only-the-webpages-content-that-was-delivered-securely-63-popup-for-custom-pages-added-to-crm.aspx

    Also see the steps by Vincenzo Di Russo (check the post Saturday, May 30, 2009 11:36) in the link below.

    http://social.answers.Microsoft.com/forums/en-us/InternetExplorer/thread/e7526a5f-F953-4235-90c3-004f9b973585

    Thanks and greetings

    Ajay K

    Microsoft Answers Support Engineer
    ***************************************************************************
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • http connections fail after removing an application via the BES

    This is consistent - happened on three different phones.

    Measures taken since the BES

    1 deploy an application that uses an HTTP (definition of a custom policy of IT) through the BES connection. Everything works fine

    2 remove the app (by its configuration was rejected.)

    3. assign the policy to the default device

    4 configuration of the software place the device no

    5 deploy

    5. wait and check that app has been removed from the default value of advertising device it in place policy

    Now, the unit measures

    1. install the app even through Javaloader - now http connections fails

    On the curve (Rogers)

    java.io.IOException: Tunnel failed

    on Tour (Verizon)

    javax.microedition.io.ConnectionNotFoundException: Protocol not found: net.rim.device.cldc.io. "http. Protocol

    Any ideas?

    Turns out I had put extra quotes in my url string. It works fine now.

    This diagnostic network (DB-00684) tool was very useful.

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

  • HTTP connection limit

    Hello guys '

    My application creates the HTTP connection. I want to increase the speed of downloading content to the web server. Content consistes of many unit data. In other words, I need to download 100 unit datas. Now, I use the connection of one for downloading this content (100 unit datas). Its download speed is too slow. I want to be fast.

    So, I think that a lot of connections can increase the speed of downloading data.

    How many connections for a single application to MAX?

    You have another way to increase download speed?

    Please share knowledge with me guys.

    TNX'

    I recently did some tests for a real-time application here performance.  Essentially on a GSM GPRS (all we have in the United Kingdom) network without EDGE, I could get about 1 K per second.  So with a single connection you should get your lot down in less than 20 seconds.

    As I said, I don't think that multiple connections will help you because:

    (a) I believe that there is only a single underlying communication method and therefore any package that you use for a connection, it is stealing this package to another connection

    (b) I suspect that there is a significant amount of overhead, establishing the connection and latency that involves.

    Please let us know how it goes...

  • How to write a program that allows an HTTPs connection to the APACHE TOMCAT server in blackberry JDE

    Hello.. I am very new to the blackberry JDE environment. But then, I have a project in which I should write a program that will make an HTTPs connection to the apache tomcat server using blackberry JDE. The simulator which I use is 8330-JDE.

    Here is my code...

    import java.io.IOException;

    Import java.io.InputStream;

    Import javax.microedition.io.Connector;

    Import javax.microedition.io.HttpsConnection;

    Import net.rim.device.api.ui.UiApplication;

    Import net.rim.device.api.ui.container.MainScreen;

    public class Httproto extends UiApplication

    {

    public public static void main (String [] args)

    {

    Httproto instance = new Httproto();

    instance.enterEventDispatcher ();

    }

    public Httproto()

    {

    pushScreen (new HttpsConnectionScreen());

    }

    }

    final class HttpsConnectionScreen extends screen

    {

    public HttpsConnectionScreen()

    {

    HttpsConnection c = null;

    InputStream is = null;

    int rc;

    try {String url =

    "https://192.168.2.3: 8443/cit/j_acegi_security_check? j_username = sanogo & j_password = redhat;

    c = (HttpsConnection) Connector.open (url);

    c.setRequestMethod (HttpsConnection.POST);

    System.out.println ("connection is open with the server");

    Get the response code is open the connection,

    Send the request and read HTTP response headers.

    The headers are stored until asked.

    RC = c.getResponseCode ();

    System.out.println ("response from the server" + rc);

    if (rc! = HttpsConnection.HTTP_OK) {

    throw new IOException ("HTTP response code:" + rc);

    }

    is = c.openInputStream ();

    Get the ContentType

    The string of type = c.getType ();

    The length and process data

    int len = (int) c.getLength ();

    if (len > 0) {

    int actual = 0;

    int BytesRead = 0;

    byte data = new byte[len]; while ((bytesread! = len) & (real! = - 1)) {

    real = is.read (data, bytesread, len - bytesread);

    bytesRead += real;

    }

    } else {}

    int ch;

    while ((ch = is.read (())! = - 1). {

    }

    }

    } catch (ClassCastException e) { throw new IllegalArgumentException ("not a HTTP URL");}

    }

    catch (IOException ioe) {}

    finally {

    Try

    {

    if (is! = null)

    is. Close();

    if (c! = null)

    c.Close ();

    }

    catch (IOException ioe) {}

    }

    }

    }

    When I run this program in the Simulator, I can do nothing. Please correct me if I'm wrong in coding.

    As I am new to this blackberry JDE environment, ideas and suggestions on how to write and run the sample applications in the blackberry are more welcomed.

    Concerning

    Hinduja

    Make sure that your MDS starts when the Simulator starts.  In the JDE will in Edition > Preferences > Simulator > General and click the checkbox "launch Mobile Data System connection with Simulator Service.

  • Hangs on the creation of HTTP connection

    Sometimes to create a connection HTTP crashes (using HTTPConnectionFactory or ConnectionFactory).  This occurs after a number of HTTP connections have been created, used and closed.

    Once again, I have a blockage, if I wait a bit, while I am able to create connections again successfully.

    If I hold down the button end call to suspend the phone in low power mode, it will also address the issue.  When I turn it back on and restart the app, it works.  But if I just restart the application, it won't work.

    I found the problem.  You must call close on the connection, not only the input and output stream.

  • Progress until you get http connection data dialog box?

    Hello

    Can someone help me with the progress dialog box until I get the Http connection data?

    I tried using Status.show but how will disappear once I have given. Once I have the data I want to update the user interface. I think it should be the combination of Thread and UiApplication.getApplication.invokelater, but if someone can guide me in the right direction, then it will be a great help.

    Concerning

    Sunil

    Check http://supportforums.blackberry.com/t5/Java-Development/Sample-quot-Please-Wait-quot-screen-part-1/t...

  • ESW-540-8 P, http connection and browsers

    Howdy,

    Portal: cisco-onplus

    VAR: 1913

    Client: 5651 (USS Nautilus SSN-571)

    Version: with On - 100K 9

    ESW540 - 8 p on a network with the default settings. The goal is to connect through proxy http OnPlus http (kubrick) devices management I / F and change the settings.

    By the compatibility of the devices for ESW540, I define http (port 80) as a method of connection and allow to "set the headers.

    Using a PC connected locally, I checked that I can establish http connection directly (without proxy OnPlus) using IE, firefox, and Safari browsers on multiple platforms (2 win 7 PCs (FF, IE, Safari), 1 iPhone4. () Safari).  In all cases, I'm able to establish the http connection to the ESW540 connection - 8 p and perform operations remotely on the device http user interface through the user interface of the browsers.

    However, when I try the same when connected remotely through OnPlus, I get different behaviors for success/failure in the browser I use.

    When I use Firefox or IE, as soon as I click on the 'Connect' button on the modal system, a browser window is launched as planned.

    For IE (IE7) on both Win7 computers, 10 seconds after the launch of the window, the device UI presents its login screen. I provide credentials for the connection. Soon after, a partial rendering of the page main 'status' for the device is presented on the user interface of the browser. I can see the CSS styles of painting, but I see no text, areno visible URL and the simulation planned device indicator is not visible. Clearly, the appliance http server enabled connection. Shortly after the connection information has been presented, a dialog box appears that States "disconnected from server...". "xlx...

    For firefox (FF 6.02) on the two WIn7PCs, I get the same behavior with one exception - the connection process does not have the point of view of the page for the device UI http authentication.

    Note, I am able to navigate, to connect to and manipulate all the pages of the user interface http to a cable modem TWC ODM built... using any platform and one of the three browsers.

    Also of note, I have configured the ESW540 - 8 p to the backup configuration file automatically and every night. This automatic access (using the credentials provided in the "References" of the modal device tab) works very well... even if she does not resemble his support in the list of devices.

    I suspect that it is a FF/IE browser config issues with specific pains of Kubrick (Java?). But I'm just guessing. Fortunately, I have Safari on all three devices, so this isn't a big deal. Ideallly, however, I prefer using FF - manage my browser of choice for all the other things-webby.

    Any help appreciated.

    See you soon,.

    Dave

    PS - I told you lately how 'killer' this "Cisco OnPlus" remote service is? It is beautiful thing you've built.

    Captain Howdy!

    The ESW540 was a little 'fun' with cross-launch. We expect a potential MR later this fall that may be able to answer some of these questions. In the meantime, I'll get the documentation updated to reflect the following details on ESW540 support.

    1. the port 80 and "Headers of difficulty" are correct configuration items to set for cross-launch.

    2. the Safari browser works fine, but you have to ignore the pop-up "lost connection". Everything works perfectly.

    3 Firefox has a particular problem. When you connect first with firefox, you'll get an error. It is different with different versions of firefox. If you copy the URL and open a new window, and then paste the URL into the new window, things will work (again, with the message lost connection to ignore).

    4 IE tends to work perfectly, without any problem. I have only tested with IE8. There could be a problem with IE7.

    These problems come from the fact that OnPlus was not there when the ESW has been developed and switches don't usually do the test to be able to withstand to be connected through a firewall. New SMB devices are tested with OnPlus in order to avoid this type of problem in the future.

    Specifically, there is a behavior of Web Management page in the ESW trys to be compatible with all web browsers and it breaks down when you launch into another page, or by an indirect method.

    Enjoy,

    Robert

    PS I'm glad you like it. Your praise seems strangely familiar though ;-)

  • HTTPS connection to the server using the connection

    Hello! It is a part of my code to connect to a secure server.

    However, it is not show me if the connection has been connected. Is there something wrong with my code?

    ' Public Sub validateUser (String usernamelogin, String passwordlogin) throws IOException {}

    HttpsConnection httpConn = null;
    String url = "https://myserverpage/login?";
    InputStream is = null;
    OutputStream os = null;
        
    Cookie string ="";
    Params string;
    params = 'name =' + usernamelogin;
    params += "& password =" + passwordlogin.replace (' ', '+');

    try {}
    Open an HTTPs connection object
    httpConn = (HttpsConnection) Connector.open (url + params);
    Setup HTTP POST request
    httpConn.setRequestMethod (HttpsConnection.POST);

    httpConn.setRequestProperty ("Cookie", cookie);
    httpConn.setRequestProperty ("Accept_Language", "en-US");
    Content-Type is essential to pass parameters in a POST request
    httpConn.setRequestProperty ("Content-Type", "application/x-www-formulaires-urlencoded");
          
          
          
    httpConn.setRequestProperty ("name", usernamelogin);
    httpConn.setRequestProperty ("password", passwordlogin);
          
    secure https
    If SecurityInfo = httpConn.getSecurityInfo ();
    Certificate c = si.getServerCertificate ();
    Object String = c.getSubject ();

    This function retrieves this connection information
    getConnectionInformation (httpConn);

    OS = httpConn.openOutputStream ();

    OS. Write (params. GetBytes());

    / * ATTENTION: os.flush () is controversial. It can create unexpected behavior
    on some mobile devices. Try it for your mobile device * /.

    OS. Flush();

    Read the response from the server

    StringBuffer sb = new StringBuffer();
    is = httpConn.openDataInputStream ();
    int chr;
    While ((chr = is.read (())! = - 1).
    SB. Append ((Char) chr);

    Web server returns only
    System.out.println (usernamelogin + "is connected" + sb.toString ());

    } {Finally
    If (is! = null)
    is. Close();
    If (OS! = null)
    OS. Close();
    If (httpConn! = null)
    httpConn.close ();
    }

    }

    The fact of this aid.

    http://supportforums.BlackBerry.com/T5/Java-development/implement-basic-HTTP-authentication/Ta-p/445...

  • Clarification: Default Http connection suffix is MDS/BES?

    Hi all:

    I had reviewed most if not all doc and discussions on the definition of the networks for the http connection. (Thanks Peter Strange)

    I need clarification on the behavior if no suffix is provided (example: Connector.open ("www.blackberry.com"))

    This is supposed to Connector.open ("www.blackberry.com;deviceside=false") - a BES/MDS connection as default

    On my Storm V4.7.0.75 no suffix works but "; deviceside = false' does not work.

    Since my Storm is not part of the company's network should work...

    Am I missing something?

    OLAF

    Verizon is an exception, they have a direct TCP stack available on the device.

  • Problem in the http connection. (simulators 5.0 os blackberry 9000 smartphone)

    Hello friends,

    I am doing my project in Eclipse Platform Version: 3.4.1 4.5 os and I'm using the 8300 Simulator. I use the http connection. When I debug my project, I work correctly. I'm download 8300 same Simulator to test the object. It worked correctly in Simulator 8300.

    but when I try 4.7 and 5.0 for Simulator that I download this Simulator my project does not work correctly the problem of http connection. Someone tell where I'm wrong?

    Thank you

    Ajay.

    also to install BlackBerry JDE 5.0.

  • HTTP connectivity from a device problem

    Hello

    I'm working on an application that works with our web server via HTTP and HTTPS.

    As it is a consumer application, we want to operate without MDS, out-of-the-box when a smartphone is purchased at retail with a web access data plan.

    I assumed that this means using direct TCP when a Wi - Fi connection is not available.

    The following code snippet prepares the URL according to the configuration, and opens the connection:

    String fullUrl = (isSecure? ("https://": "http://") + appConfig.getServerHost () + "/" + url + (bbAppState.isWiFiOnly ()? « ; (interface = wifi': "") + (bbAppState.isDeviceSide ()? « ; (deviceside = true': ' ");

    c = (HttpConnection) Connector.open (fullUrl, Connector.READ_WRITE, true);

    Details of equipment and network:

    Feature: 8320
    OS 4.5.0.81
    T-Mobile US network
    Have a data plan (unlimited web and 400 messages)
    Connection preference: Wi - Fi preferred
    No apn is not specified
    Browser and third-party applications downloaded from the App World can access internet via Wi - Fi and EDGE/GPRS with the above parameters

    Tried:

    1. Free Wi - Fi and EDGE: deviceside = true - get "Tunnel failed '.
    2. Free Wi - Fi and EDGE: no deviceside, only the url - get "Tunnel failed '.
    3. No deviceside, only = wifi interface - works with a Wi-Fi connection, reports "The Tunnel failed" when out of range of a Wi - Fi connection.
    4. I tried parameter APN to internet2.voicestream.com just to test - got the same error 'Tunnel failed '.  I would not use it as the browser and other applications need and work when the APN is empty.

    My question is if I'm something wrong or missing something.  My hypothesis is that third-party apps and BlackBerry Internet Service browser.  Is there a way to know?  Is there a way to disable it (for example to make sure that the browser and other applications use it)? Our company has recently become a partner of Alliance of BlackBerry, so we can apply to BlackBerry Internet Service, but I do not understand if this is necessary for consumer applications, or if the consumer applications should rely on direct TCP.

    Any help will be greatly appreciated.

    Thank you

    Sergey

    Use '; deviceside = true ', you must also specify the details of the AFN, the options of the device or in the string you provide with "; deviceside = true '.  If you do not, you will get "Tunnel failed '.

    I would like to confirm the settings for T-Mobile APN - the value that you used does not match what I found in a google search.

    Browser and other applications will use WAP 2.0 or BIS - B, requiring no configuration.  You can use WAP 2.0 - standard article for more details:

    What - in different ways to establish an HTTP connection or socket
    DB-00396
    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

    Recommendation - use BIS-B (service Alliance Partner) If you can, work in cases more than anything else.

Maybe you are looking for