问题
I'm trying to create an app which works as a remote-control for my musicplayer. I've just finished written a nice library for my code and I just now noticed there is no assembly called System.Net.Sockets for Windows Phone 8.1? There must be a solution to this, but I just cannot find it. Does anyone know how I might be able to import it to my project?
回答1:
According to Microsoft, you should be using Windows.Networking.Sockets
instead:
The Windows Runtime API, Windows.Networking.Sockets, has been adopted for Windows Phone 8. It has been implemented as a Windows Phone Runtime API, making it easy to use in whatever supported programming language you choose. Although we've enhanced the .NET API, System.Net.Sockets, to support more features such as IPv6 and listener sockets, you should consider using the new API for sockets programming because it is more portable than the .NET API. Windows.Networking.Sockets has been built from the ground up to be clean, secure, and easy-to-use APIs that enforce best practices.
In WinRT, this is what you need to do. Here's an answer to a related question for further reading.
来源:https://stackoverflow.com/questions/23477961/cannot-find-system-net-sockets-assembly-for-wp-8-1