html javascript connect to raw socket

前端 未结 2 1555
-上瘾入骨i
-上瘾入骨i 2021-01-22 12:40

I have a c# tcp server, I want to connect to the server via a html client page.

The problem: There is no simple way to create TCP sockets in Javascript

2条回答
  •  离开以前
    2021-01-22 13:00

    No. There just isn't. The browser is a tightly locked down environment. The only socket connection that you can open from JavaScript is WebSocket. Since it's your server, adding WebSocket support shouldn't be too complicated, and there are WebSocket libraries available for C#.

提交回复
热议问题