Reputation: 74
I am trying to use websocket
in my xamarin.android
application, but am unable to connect with server using websocket class
.
Using WebSocket4net
NuGet Package, but it's not working.
Code
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();
Upvotes: 0
Views: 324
Reputation: 74
I found solutions with following Site Demo Code:
https://websocket4net.codeplex.com/
but it's display state=0(connecting)
Upvotes: 0