Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7775145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:33:20+00:00 2026-06-01T17:33:20+00:00

I am trying to make http request on blackberry platform, My problem is: When

  • 0

I am trying to make http request on blackberry platform, My problem is: When I make connection via WiFi it works good, but when I use mobile network it doesn’t work and the connection freeze

Here is my code

    public static String getHttpUTFResponse(String url) {
    url = addConnSuffex(url);
    HttpConnection connection = null;
    byte responseData[] = null;
    try {
        connection = (HttpConnection) new ConnectionFactory()
                .getConnection(url).getConnection();
        int len = (int) connection.getLength();
        System.out.println(len);
        if (len != -1) {
            responseData = new byte[len];
            DataInputStream dis;
            dis = new DataInputStream(connection.openInputStream());
            dis.readFully(responseData);
            dis.close();
        }
    } catch (IOException e) {
        System.out.println("Connection Error");
    } finally {
        if (connection != null) {
            try {
                connection.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            connection = null;
        }

    }
    if (responseData != null) {
        try {
            return new String(responseData, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    } else {
        return null;
    }
}

public static String addConnSuffex(String url) {
    ServiceBook sb = ServiceBook.getSB();
    ServiceRecord[] records = sb.findRecordsByCid("WPTCP");
    String uid = null;
    if (records == null) {
        return url;
    }
    for (int i = 0; i < records.length; i++) {
        if (records[i].isValid() && !records[i].isDisabled()) {
            if (records[i].getUid() != null
                    && records[i].getUid().length() != 0) {
                if ((records[i].getUid().toLowerCase().indexOf("wifi") == -1)
                        && (records[i].getUid().toLowerCase()
                                .indexOf("mms") == -1)) {
                    uid = records[i].getUid();
                    break;
                }
            }
        }
    }
    if (DeviceInfo.isSimulator()) {
        return url;
    }
    if (uid != null) {
        // open a WAP 2 connection
        url = url + ";deviceside=true;ConnectionUID=" + uid;
        System.out.println("**************** on conn" + url);
    } else {

        url = url + ";deviceside=true;interface=wifi";
        // Consider another transport or alternative action.
    }
    System.out.println("**************** on conn" + url);
    return url;
}

Thanks a lot

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:33:22+00:00Added an answer on June 1, 2026 at 5:33 pm

    For network connection TransportDetective.class is more use full you can resolve lot of problem related to network.

    TransportDetective y URLFactory para configurar la conexion a web

    Different ways to make an HTTP or socket connection

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to connect with google via oauth V2 I make http request
I'm trying to make an HTTP GET request using the jQuery get() function, but
I'm trying to make an HTTP Get request using JQuery, but I get an
I am trying to make a simple request using http.get. But I need to
I have the problem to construct URI to make http request via HTTP library.
The problem I am trying to make a generic http module in asp.net C#
I'm trying to make use of Vexflow ( http://vexflow.com/ ) on the Android. However,
I'm trying to make a simple HTTP POST request, and I have no idea
I am trying to make a get http request using jquery getJSON function. I
Say I make an HTTP request to: foosite.com but the port I actually send

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.