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

  • SEARCH
  • Home
  • 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 7492611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:29:03+00:00 2026-05-29T16:29:03+00:00

Using: HTC Legend and HTC Salsa I’m calculating the speed using: while(true) { try

  • 0

Using: HTC Legend and HTC Salsa

I’m calculating the speed using:

while(true)
        {
            try 
            {
                int num = in.read(buffer);
                if(reading == false)
                {
                    prevTime = SystemClock.uptimeMillis();
                    reading = true;
                }
                else
                {
                    //Calculate KB/s
                    count += num;
                    Long deltaTime = SystemClock.uptimeMillis()- prevTime;
                    if(deltaTime >= 1000)
                    {
                        Float speed =  (float)count/deltaTime;
                        Log.d(TAG,"Data: " + speed + "KB/s");
                        count = 0;
                        prevTime = SystemClock.uptimeMillis();
                    }
                }

            } catch (IOException e) {
            }
        }

And writing some test data using

out.writeUTF("ababababababababababababababababbabababaababababababababababababababababbabababaababababababababababababababababbabababa" +
                        "ababababababababababababababababbabababaababababababababababababababababbabababaababababababababababababababababbabababa" +
                        "ababababababababababababababababbabababaababababababababababababababababbabababaababababababababababababababababbabababa" +
                        "ababababababababababababababababbabababaababababababababababababababababbabababaababababababababababababababababbabababa");
out.flush();

The writes are within another threads while(true) also.

I’m getting the following results.

02-13 18:17:16.897: D/krazyTag(3432): Data: 31.554672KB/s
02-13 18:17:17.927: D/krazyTag(3432): Data: 29.854227KB/s
02-13 18:17:18.977: D/krazyTag(3432): Data: 29.285034KB/s 
02-13 18:17:20.067: D/krazyTag(3432): Data: 38.446888KB/s 
02-13 18:17:21.097: D/krazyTag(3432): Data: 35.89484KB/s 
02-13 18:17:22.127: D/krazyTag(3432): Data: 33.67118KB/s 
02-13 18:17:23.227: D/krazyTag(3432): Data: 33.512726KB/s
02-13 18:17:24.307: D/krazyTag(3432): Data: 33.277622KB/s

Which is confusing me since the phones specs state they use Bluetooth® 2.1 with EDR

Which is capable of 260KB/S but I’m not even getting the old standard 90KB/s

I’m not sure if it’s my stream and read/write calls (I’m using a buffered datainputstream)
Or if I’m calculating things wrong or have the wrong information?

  • 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-05-29T16:29:04+00:00Added an answer on May 29, 2026 at 4:29 pm

    I think the speed depends on your implementation of the Send and Receive threads, since you connects 2 Android devices with your own applications. Could you post your implementation?

    I got the same problem also.
    I am using ACER TAB A500 to communicate with a Bluetooth stick connected to PC and I got even slower result 12,3KB/s for sending data only.

    That’s why I did some experiments. I sent a message for 10000times and I got that the data rate depends on the length of the message.

    For 1KB message, the data rate is 232KB/s.
    For 40Byte message, the
    data rate is 18KB/s.
    For 1Byte message, the data rate is
    0.48KB/s.

    Here is my code:

    // Get the BluetoothDevice object.
    while(true){
        driverBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        driverBluetoothDevice = driverBluetoothAdapter.getRemoteDevice("XX:XX:XX:XX:XX:XX");
        if (driverBluetoothDevice == null){
        break;
        }
    
        Method insecureMethod = driverBluetoothDevice.getClass().getMethod("createInsecureRfcommSocket", new Class[] { int.class });
        byte portNumber = 5; // The SPP in port 5.
        driverBluetoothSocket = (BluetoothSocket) insecureMethod.invoke(driverBluetoothDevice, portNumber);
    
    // Try to connect to the Bluetooth device.
    try {
        driverBluetoothSocket.connect();
    } catch (IOException e1) {
        // Failed to connect to the device
            break;
    }
    
        // Open input and output stream.
    try {
        driverInputStream = driverBluetoothSocket.getInputStream();
    } catch (IOException e) {
        break;
    }
    try {
        driverOutputStream = driverBluetoothSocket.getOutputStream();
    } catch (IOException e) {
        break;
    }
    
    byte[] message = new byte[3000];
    Random randomGenerator = new Random();
    for (int i = 0; i < message.length; i++){
        message[i] = (byte) randomGenerator.nextInt(100); 
    }
    
    Date TimeValue = new Date();
    long TimeStamp1 = TimeValue.getTime();
    for (int i = 0; i < 10000; i++){
        try {
            driverOutputStream.write(message, 0, message.length);
        } catch (IOException e) {
            break;
        }
        }
    
    TimeValue = new Date();
    long TimeStamp2 = TimeValue.getTime();
    long TimeDifference = TimeStamp2 - TimeStamp1;
    TimeDifference = 0;
        break;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using HTC Dream and trying to read the images stored in the default
I would like to try using .htc files or PIE to emulate some CSS3
Im using HTC Hero with HTS sense. Im experience that sometimes AsyncTask not will
We have some really old code that calls WebServices using behaviours (webservice.htc), and we
I am trying to get the GPS location of my HTC magic using the
I've made a site using this border radius code: http://code.google.com/p/curved-corner/ I'm referencing to url(border-radius.htc)
I have just switched over from the old png transparency fix using a htc
I'm trying to run rounded corners on <= IE8 using border-radius.htc located here .
I am interested in developing an app for my HTC Magic (Android) phone. Using
I have been using the .htc version of PIE successfully on a new project

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.