如何通过 iPad 上的套接字同步计数器
我在 PC 上有一个应用程序,它显示播放的 mp3 歌曲的时间信息。我现在需要在 iPad 应用程序中显示该时间信息。 iPad 和 PC 之间的剩余时间、播放器位置和歌曲长度的计数计时器必须同步。
我考虑过使用套接字连接(iPad 上的 AsyncSocket)来保持计数器同步。
有更好的方法吗?我不想跑错方向...
另外,将来应该可以有不止一台 iPad 显示信息。这是一个“很高兴拥有”的功能......
我不需要准备好使用代码片段,这更多的是一个理论问题。 (如果有人有现成的代码片段,这对我来说也有好处:-))
MadMaxApp
I have a Application on a PC which displays time-information for a mp3 song that is played. I now need to display this time information within an iPad App. The counting timers for remaining time, player position and song length must be in sync between iPad an PC.
I thought about using a socket connection (AsyncSocket on iPad) to keep the counters in sync.
Is there a better way doing this? I don't want to run in the wrong direction...
Additional, it should be possible to have more than one iPad showing the Information in future. That's a "nice to have" feature...
I don't need ready to use code snippets, it's more a theoretical question. (if someone has a ready to use code snippet, that's also good for me :-) )
MadMaxApp
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我现在使用AsyncSocket来解决需求。它工作完美。如果应用程序进入后台,请不要忘记关闭套接字连接的处理。根据应用程序正在通信的服务器,不关闭套接字可能会导致重新连接时出现问题。
i now used the AsyncSocket to solve the requirements. It works perfectly. Don't forget the handling of closing the socket connection if the app goes in background. Depending on the server the app is talking with, not closing the socket can lead to a problem in reconnecting.