WebSocket不能与Xamarin.Android一起使用

问题描述:

我想在我的xamarin.android应用程序中使用websocket,但无法使用websocket class与服务器连接。WebSocket不能与Xamarin.Android一起使用

使用WebSocket4net NuGet包,但它不起作用。

代码

WebSocket websocket = new WebSocket("ws://" + IPData[0].Trim() + ":" + IPData[1].Trim()); 
        if (websocket.State != WebSocketState.None) 
        { 
         var videoIntent = new Intent(this, typeof(VideoActivity)); 
         StartActivity(videoIntent); 
        } 
        else 
        { 
         new AlertDialog.Builder(this) 
         .SetPositiveButton("Ok", delegate 
         { 

         }) 
         .SetTitle("Connection Error") 
         .SetMessage("Not Connect to server") 
         .Show(); 
        } 

       }) 
       .SetTitle("IP Updated") 
       .SetMessage("IP Info Updated Successfully") 
       .Show(); 

我找到解决方案,以下网站演示代码:

https://websocket4net.codeplex.com/

但它= 0(连接)显示状态