iPhone SDK:手机到手机的文件传输
将文件从 iPhone 复制到 iPhone (p2p) 的最简单方法是什么?
我能想到的唯一方法是:
使用 Bonjour 发现服务器应用程序(它将通过 Bonjour)
使用 NSStream(或套接字),然后从对等方的文件中传输数据 到对等点(读取文件的块,发送文件的块等等,直到读取整个文件)
是否有一个 API/方法可以处理所有流数据,并且只需将文件从一个地方复制到另一个地方,而不需要执行低杠杆操作使用流或套接字进行编程(类似于 http://msdn .microsoft.com/en-us/library/ms740565(VS.85).aspx)?
我想我也可以使用 GameKit 并通过建立会话传输数据,但似乎 Baonjour 提供了更多灵活性。
谢谢
What is the simpliest approach to copy files from iPhone to iPhone (p2p).
The only way I can come up is this:
Use Bonjour to discover server app (which will advertize itself via
Bonjour)Use NSStream (or sockets) and then stream data from the file from peer
to peer (read chunk of the file, send chunk of the file and so on until entire file is read)
Is there a APIs/Method which would take care of all streaming data and just copy a file from place to place without doing low lever programming with streams or sockets (similar to http://msdn.microsoft.com/en-us/library/ms740565(VS.85).aspx)?
I guess I can also use GameKit and stream data over establish session, but it seems that Baonjour provides more flexibility.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
iFiles 应用程序 (http://itunes.apple.com/us/app /ifiles/id336683524?mt=8) 也以其他方式执行,用户可以使用浏览器将文件从桌面传输到 iPhone。所以他们为此使用了简单的 html、js。
但是,如果考虑 iPhone 到 iPhone 的文件传输,那么它是应用程序到应用程序特定的通信,这意味着我们需要在低级别对其进行编码,处理流媒体和所有事情。因为在 iPhone 中你不能像桌面一样选择文件:)
iFiles App (http://itunes.apple.com/us/app/ifiles/id336683524?mt=8) does in other way too, user can transfer files using browser from desktop to iPhone. So they used simple, html,js for this.
But if iPhone to iPhone file transfer is considered then its app to app specific communication, which means we need to code it in low level, taking care of streaming and every thing. because in iphone you cannot choose files like desktop :)