Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
269 views
in Technique[技术] by (71.8m points)

javascript - How to talk to UDP sockets with HTML5?

What I have : A C++ application server running, Ready to send data to client which is supposed to a HTML5 page or app.

What I want : Is there any way to communicate using udp port with HTML5 given both c++ server and HTML5 app are local to system ?

What I know :

  • Because of Security Concern, JS doesn't allow UDP port communication from browser.
  • Have read in many places, Answer is no. But answers are old.

Is the answer still 'NO' ?

Is there any work-around possible ?

Any lead is appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Yes, the answer is still 'no'. Websockets are TCP based. Note that a WebSocket is not a plain TCP connection, there is HTTP negotiation and a framing protocol in place. So you also cannot create a plain TCP connection in Javascript.

WebRTC is based on UDP, it may cover your use cases: http://www.html5rocks.com/en/tutorials/webrtc/datachannels/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...