It is possible to access a port via TCP/UDP from a web application

Asked

Viewed 110 times

4

It is possible to send data to a port (e.g.: 5151) via TCP or UDP from a site, on the front end, using Javascript for example.

I’ve been searching for a while and the closest I’ve come so far is creating a Chrome app using the API sockets however, I had two problems with this.

1º to use the API sockets needs to be an App instead of an extension, so it needs to run, which is impractical for the end user.

2nd is that I could not send any kind of information to him from the page, nothing, not even a "hello world".

  • Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site

1 answer

4

Generally speaking, in real web application, running in a standard browser, there is no way to do it directly.

It is possible to use certain devices such as Websockets that encapsulate TCP within HTTP, which obviously loses TCP’s main advantage over HTTP to be more efficient, so you make it work for compatibility or because you need some feature that TCP has, such as maintaining connection status, but not pure TCP. And it won’t be the door you want, it’ll be at door 80.

If you use a non-standard browser or some plugin can use these protocols directly, but in general will not be what wants, should not make much sense.

Depending on what you want, you must abandon web technology, or else conform to this limitation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.