Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading from udp port in browser

Aside from Java Applet, is there anyway we can read from an UDP socket? I know websockets are TCP sockets, but I need to communicate with a server via udp sockets, anything in HTML5, or anything at all? I have looked at this post from: two years ago and this one as well again from two years ago no UDP. I was wondering if there is any new way now that we are in 2013 to use the browser to communicate with a server via udp socket?

like image 756
C graphics Avatar asked Jul 11 '13 23:07

C graphics


People also ask

Can you use UDP in the browser?

UDP packets are not encrypted, so any data sent over these packets could be sniffed and read by an attacker, or even modified in transmit. It would be a massive step back for web security to create a new way for browsers to send unencrypted packets.

Does Chrome support UDP?

Chrome Apps can act as a network client for TCP and UDP connections.


2 Answers

What you are looking for can't be done with in Javascript due to security constraints such as Distributed Denial of Service (DDOS) attacks. The closest technology available (that I know of) for client-side JS is WebRTC.

With WebRTC you can use DataChannels over SRTP and ICE as a possible solution.

See Also:

  • How to send a UDP Packet with Web RTC - Javascript?
  • Can I use WebRTC to open a UDP connection?
like image 188
Jeremy Harris Avatar answered Sep 18 '22 13:09

Jeremy Harris


You can use both TCP and UDP connections with the chrome.socket API, but this is only for Packaged Apps (i.e. apps that are bundled in a container to be run as desktop apps).

The API was available for a while for Chrome extensions, when it was in experimental status (see this answer, from a user who works at Google and was co-presenter for Packaged Apps at Google I/O 2012)

like image 31
natchiketa Avatar answered Sep 20 '22 13:09

natchiketa