在 pcl 中使用 TcpClient 以针对 ios 和 android 的 xamarin

Using TcpClient in pcl for xamarin targeting ios and android

我正在编写一个通过 tcp 套接字与嵌入式 linux 服务器通信的应用程序。我正在寻找一种方法来使用 Xamarin C#.

编写针对 iOSAndroid 设备的通用客户端代码

我想知道 TcpClient class (System.Net.Sockets) 是否可以用于 pcl 目标 iOSAndroid .如果没有,我还有什么其他选择?

我刚刚发布了第一个 library 版本,它覆盖了 .NET 和 WinRT 套接字实现,允许您在 PCL 中编写针对 Xamarin iOS/Android、Windows 商店、Phone 和桌面。根据您需要的可配置性级别,TcpSocketClient class 可能会起作用。

它依赖于 'Bait and Switch' PCL 模式,因此您需要在 PCL 项目和本机平台项目中安装 nuget 包。