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 6633785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:51:13+00:00 2026-05-25T22:51:13+00:00

I have a instream that takes in raw binary data from Bluetooth on Android

  • 0

I have a instream that takes in raw binary data from Bluetooth on Android 2.2 phone. The data coming in goes into a buffer 1024 in size. I read() the data and then take that and write to a file. I send that file via FTP to my computer. I noticed a disturbing pattern when ftp’ing that an extra character gets inserted every once in a while. So I printed out the buffer first to LogCat and noticed the character was not there. Here is my read write code.

FTPClient con = new FTPClient();
File file = new File(Environment.getExternalStorageDirectory() + "/ftp/new/" + "testdata.bin");

try {
    con.connect("someIPAddress");
    if (con.login("anonymous", "anonymous@anon.com")) {
        con.enterLocalPassiveMode(); // important!

        FileInputStream in = new FileInputStream(file);
        boolean result = con.storeFile("testdata.bin", in);
        in.close();
        if (result) {
            Log.v("upload result", "succeeded");
        }
    }
} catch (Exception e) {e.printStackTrace();}

Here is an example of the output from the logcat:

09 15 D0 0D 17 0A 06 08 07

and here is what is in the file after ftp’ing:

09 15 D0 0D 17 0D 0A 06 08 07

Well I thought that hmm 0A something is injecting 0D to make (CRLF) but it doesn’t happen at every 0A. I can write the same program in C# and this doesn’t happen at all. So any ideas or help?

On further investigation I found it occurs when the data going in is 17 0A and the file shows 17 0D 0A.

  • 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-25T22:51:14+00:00Added an answer on May 25, 2026 at 10:51 pm

    Solution: The FTPClient will send the file by default as ASCII. Set the fileType to Binary file by using this command:

    con.setFileType(FTP.BINARY_FILE_TYPE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that takes in a data file of students that have
I have written a program that takes the filename from argv[1] and do operations
I have a char* and the data length that I'm receiving from a library,
I have a function that takes an ostream reference as an argument, writes some
I know cout and printf have buffer today, and it is said that the
I have been trying to create a templated class( Test2 ) that takes 2
I have a function in C++ that takes in an std::istream as the input:
I have a while loop here that only takes in 1 and 2 as
Hello! My problem can be described the following way: I have some data which
I am trying to write a program that takes an input of of n

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.