i know i am missing something simple but i need to have My console output be displayed in a webpage with express and ejs i am getting the UDP in my Console . can anyone help me out. thank you

  //  Javascript

   import express from "express";
   import dgram from "dgram";

    const socketServer = dgram.createSocket("udp4");
    const app = express();

    app.get("/", (req, res) => {
     //res.send("Hello World!");
    });

    socketServer.on("message", (msg, rinfo) => {
    console.log(`got messsage from ${rinfo.address}, data: ${msg}`);
    });

    app.listen(5000, () => {
    socketServer.bind(5000);
    console.log(`Backend started!`);
    });

Recommended Answers

All 2 Replies

Unfortunately this is outside of my area of expertise, but I've retagged this topic with javascript and express, so hopefully you'll be able to attract more relevant helpers.

There's too much missing here. Given that you have Javascript I think this is already on a web page of either htm or html so maybe and this is guessing as the entire code base is not up for introspection (yes, I meant to use that word here) my thought is you need a web/page object to write what you want to write so it's visible without opening the console.

Here's a tutorial on how to change text in an textarea object: https://www.w3schools.com/jsref/prop_textarea_value.asp
Doesn't look took hard as it's one line of code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.