0
I would like to know if there is any way I can send data to a udp client in nodejs through a browser. I have a form with any 2 fields, I need to take this data placed in the form and send it to the udp client, I don’t know how to do it right, in my client I have something like this:
client.on("listening", () => {
const address = client.address();
console.log(`server listening ${address.address}:${address.port}`);
});
He keeps listening at a random door, I just wanted to take the form data and give it to this guy. my html is in the machine, there is no http server, it is in the /user/desktop/name/index.hml
even
udp ? client is sure ? by the code you posted seems to be a server...and are sure it’s udp you really want ? why udp ? there is no way to use udp in the browser...the configuration that makes the most sense is a websocket server in Node.js, and then yes, it is very easy for the browser to communicate with that server
– zentrunix
I ended up getting the wrong code, I got the code from the udp server, but this piece of code serves both the server and the client, this nomenclature is just to differentiate, both sides the code is very similar. and yes, I’m sure, it’s a college job, and I have to use UDP, if it was with websocket using tcp I would have already finished, my problem is that I don’t know how to make a communication from the browser with anything that is by the udp protocol.
– Fernando
I even created a socket tcp and made the browser send data to it, but the problem is that it’s a socket for tcp right, and I need to use a socket udp. For what I’ve been researching the browser only implements communication tcp. you wouldn’t have an alternative to this ? any idea ?
– Fernando
in accordance with this question asked in English OS, is not possible use UDP in browser...who asked for the exercise doesn’t know what you’re talking about, or else you didn’t understand what was asked for
– zentrunix
It was not a job specification, I was looking for on my own, browser inclusion was not required. But ok, vlw by the help
– Fernando