【问题标题】:How to create a socket connection in Tizen C# (Weareble)如何在 Tizen C#(可穿戴)中创建套接字连接
【发布时间】:2020-04-15 23:05:52
【问题描述】:

我连接了 WebSocketSharp 库。 在服务器上,我看到一个新客户端正在连接,然后在 VisualStudio 中弹出一个错误,在服务器上的日志中我看到客户端已断开连接 同样在应用程序日志中,我看到消息“套接字:打开”

Tizen.NET 6.0.0.14995
Tizen.Wearable.CircularUI 1.4.0
WebSocketSharp-netstandard 1.0.1
Xamarin.Forms 4.3.0.908675
ws = new WebSocket("wss://server.com/socket.io/?EIO=3&transport=websocket");
ws.WaitTime = TimeSpan.FromSeconds(3);
ws.OnOpen += (sender, e) => {
   Tizen.Log.Debug(LOG_TAG, "Socket: open");
};
ws.Connect();

错误弹出窗口:

System.PlatformNotSupportedException: Operation is not supported on this platform.
   at System.Action`1.BeginInvoke(T obj, AsyncCallback callback, Object object)
   at WebSocketSharp.WebSocket.open()
   at WebSocketSharp.WebSocket.Connect()
   at testapp.App.StartTracking()
   at testapp.App.SetStatus(Boolean status)
   at testapp.UI.OnClick(Object sender, EventArgs args)
   at Xamarin.Forms.TapGestureRecognizer.SendTapped(View sender)
   at Xamarin.Forms.Platform.Tizen.TapGestureHandler.OnCompleted(View sender, Object data)
   at Xamarin.Forms.Platform.Tizen.GestureHandler.Xamarin.Forms.Platform.Tizen.IGestureController.SendCompleted(View sender, Object data)
   at Xamarin.Forms.Platform.Tizen.GestureDetector.OnGestureCompleted(GestureType type, Object data)
   at Xamarin.Forms.Platform.Tizen.GestureDetector.<>c__DisplayClass25_0.<AddTapGesture>b__1(TapData data)
   at ElmSharp.GestureLayer.<>c__DisplayClass61_0`1.<SetCallback>b__0(Object info)
   at ElmSharp.GestureLayer.GestureCallbackHandler(IntPtr data, IntPtr event_info)
   at Tizen.Applications.CoreBackend.UICoreBackend.Run(String[] args)
   at Tizen.Applications.CoreApplication.Run(String[] args)
   at Tizen.Applications.CoreUIApplication.Run(String[] args)
   at testapp.Program.Main(String[] args) occurred

【问题讨论】:

  • "此平台不支持操作。" - 我认为这是 Tizen 不支持您尝试做的事情的证据
  • 感谢您的回答!我尝试了另一个库 - 它有效。我比以往任何时候都更快乐:) archive.codeplex.com/?p=websocket4net
  • WebSocketSharp 库编写不佳,不适用于 .NET Core(不仅在 Tizen 上)。这个问题不断被报告,但我认为它不会得到修复。 github.com/sta/websocket-sharp/issues/473github.com/sta/websocket-sharp/issues/487
  • 您能否告诉我们有关您的可穿戴应用程序用途的更多详细信息?
  • 任务很简单——将位置坐标传输到服务器。感谢您的回复。我设法使用 websocket4net 库实现了套接字连接:)

标签: c# xamarin websocket tizen tizen-emulator


【解决方案1】:

我设法使用另一个库实现了套接字连接 - https://archive.codeplex.com/?p=websocket4net

【讨论】:

  • 感谢分享。不要忘记接受答案哦~
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多