如何防止在网络上传输文件时数据丢失? [英] How to prevent data loss when transferring files over a netrwork?

查看:311
本文介绍了如何防止在网络上传输文件时数据丢失?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





如何使用tcp / ip协议将文本文件从Android发送到C时防止数据丢失。我试图从Android发送一个8kb的文本文件到C,但我只收到4kb。如何克服上述问题。

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.

推荐答案

你没有发送所有数据。保存收到的数据并将其与原始数据进行比较。我的提示是,您发送一个字符串并使用字符串长度,但您需要发送缓冲区大小。一个字符有2个字节的缓冲区。
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.


这篇关于如何防止在网络上传输文件时数据丢失?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆