将文件从 PC 复制到 Windows Mobile 设备的好方法是什么?
我有一个在服务器上运行的 C# 应用程序,它需要将文件复制到多个 Windows Mobile 5.0 设备。这些设备通过支持以太网的通讯座直接连接到网络(因此它们不通过 ActiveSync 连接到 PC)。
为此我有哪些不同的选择?我知道 RAPI 可以做到这一点,但我不确定它是否可以像这样直接通过网络复制某些内容。另外,我知道 RAPI 使用 ActiveSync DLL,因此需要安装 ActiveSync,如果可能的话,我们希望避免这样做。
WMI 可行吗?如果我们能够以某种方式获取每个设备的 IP 地址,我们可以使用普通的 File.IO 吗?代码示例或一般知识将是最受欢迎的。
I have a C# application running on a server, and it needs to copy files out to multiple Windows Mobile 5.0 devices. These devices are connected to the network directly via Ethernet-enabled cradles (so they are not connected to a PC via ActiveSync).
What different options do I have for doing this? I know RAPI can do this, but I'm not sure if it can copy something directly over the network like this. Also, I know RAPI uses ActiveSync DLLs and thus requires ActiveSync to be installed, and we would prefer to avoid doing this if possible.
Is WMI a possibility? Can we use ordinary File.IO
if we can somehow get the IP address of each device? Code samples or general knowledge would be most welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
普通的文件 I/O 不起作用。这些设备没有文件共享操作系统组件,因此您无法像 PC 一样通过网络“浏览”它们。
RAPI确实使用ActiveSync,因此您不仅必须安装AS,还必须主动连接设备,而且ActiveSync一次只允许一台设备连接,因此它无法满足您的要求。
我对这种情况的解决方案始终是相同的。您必须在设备上安装某种“侦听器”,无论是您部署的应用程序还是某种形式的安装程序。有时我在插入的 CF/SD 卡上使用自动运行应用程序(一切都取决于您的拓扑)。
我通常让该应用程序侦听来自 PC 的“发现”数据包的 UDP 广播。当他们收到它时,他们又通过 UDP 广播出他们的 IP 地址,然后 PC 收集这些地址。然后,PC 通过侦听器应用程序通过 TCP 套接字将文件发送到设备。
最近,我一直在通过 Padarn 托管的 REST 服务来完成所有设备端部分,以最大程度地减少我必须编写的设备上的通信代码量,但您可以使用 Udp/TcpClients 完成这一切,没有太大困难。
Normal file I/O isn't going to work. The devices don't have file sharing OS components, so you can't "browse" to them over the network like you might a PC.
RAPI does use ActiveSync, so not only do you have to have AS installed, the devices must also be actively connected, and ActiveSync only allows one device connection at a time, so it's not going to work for what you want.
My solution for this type of scenario has always been the same. You have to install some sort of "listener" on the devices, whether it is your deployedd app or some form of installer. Sometimes I use an autorun app on an inserted CF/SD card (all depends on your topology).
I usually have that app listen for a UDP broadcast of a "discover" packet from the PC. When they receive it, they in turn UDP broadcast out their IP address and the PC collects those. The PC then sends the files via a TCP socket to the device(s) through the listenner app.
Lately I've been doing all of the device-side pieces via a REST service hosted in Padarn to minimize the amount of comms code on the device I have to write, but you could do it all with Udp/TcpClients without too much difficulty.