I'm developing a window 7 phone app and I would like that app to be able to share data with other phones running the same app. I would like the app to be able to send and recieve 开发者_运维知识库data from phone to phone. I have looked into Push Notification Services. However, I would like to be able to avoid having a web service in the middle for performance reasons. Should I be looking into Sockets? Is this doable in this environment?
You can't have listening sockets in Mango. So I'm not sure you can do it without at least some service to help you initiate the connection between the 2 even when using sockets.
Ricky Tan has published an article explaining how to implement this scenario using UDP multicast to facilitate multiplayer gaming on the same WiFi network.
In your case, an intermediary layer is pretty much a must because of limited sockets support (read: your phone cannot act as a server). You could implement a very basic token exchange, but you will need specific phone and account identifiers so that the exchange goes only between two specific devices and not broadcasted to every single connected device.
Ultimately, you could use a WCF service for this as well, but the performance gain with sockets will be visible.
精彩评论