开发者

Unable to transfer file over Bluetooth using code

I am trying to transfer file over Bluetooth using code. I am using socket programming to transfer file. I have successfully made Bluetooth connection(Samsung Galaxy Tab) established with another device(Htc Desi开发者_开发技巧re).

Now problem is, i can send any text message but unable to send any file between device.

Please any body help me about this.

Thanks,


Sounds like you're in need of some sort of application-layer protocol for transferring files to layer on top of your working socket connection.

I'm unfamiliar with the details of these devices but you can probably use a standard protocol, such as FTP or HTTP, in which case there is likely to be a built-in (OS-level) API you can use to effect the transfer.

Alternatively, you can roll your own protocol. It could be as simple as this:

1) Send 64-bit int containing string length of filename (bytes)
2) Send filename string
3) Send 64-bit int containing length of file in bytes
4) Send contents of file
5) Disconnect

Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜