Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

How to prevent data loss when text file is sent from Android to C using tcp/ip protocol. I am trying to send a text file of 8kb from Android to C, but i am receiving only 4kb. How to overcome the above issue.
Posted
Comments
[no name] 16-Apr-15 1:57am    
You have just stated that you have a problem. This is a technical forum - please provide some technical information. For example a few minimal lines of code showing send and receive.

1 solution

You arent sending all data. Save the received data and compare it with the original. My tip is, that you send a string and use the string length, but you need to send the buffer size. One character has 2 bytes of buffer.
 
Share this answer
 
Comments
venkat28vk 16-Apr-15 3:42am    
I have done what you have said, for example i have sent an audio file from android to C using tcp/ip protocol. I have received the audio file but with some data loss in it. For ex 4 bytes is sent i am able to receive 4 bytes but there is a mismatch in the bytes when i check the properties. But the file is playing good how to overcome the few data loss.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900