Best way to manage network state in Windows Mobile

后端 未结 4 1193
野的像风
野的像风 2021-01-31 12:35

I have a .NET Compact Framework 3.5 program that is used as a \'Occasionally Connected\' line of business (LOB) application. If it can see an online webservice, it will use tha

4条回答
  •  一向
    一向 (楼主)
    2021-01-31 13:27

    I try to write Mobile apps so they don't even know there's a network involved. I keep good-enough validation data locally, and then write transactions to a local queue which clears while connected; the queue reader includes a timer to retry when not connected. The queue messages are bidirectional, so local refreshes can be supplied as well. Basic Message Queue patterns.

    This allows me to treat the network connection in the simplest way, using basic socket open/close/read/write/ioctl logic that's highly portable; and your connections don't need to persist for any significant time at all. (I'd hate to imagine what would be required to stay in sync with all the MS architecture variations over the last several years - which still hasn't settled out IMHO.)

提交回复
热议问题