mansa mansa - 1 year ago 153
Javascript Question

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.

Answer Source

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 cannot either create a plain TCP connection in Javascript.

WebRTC is based on UDP, it may cover your use cases:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download