Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

391
Views
UDP javascript - Uncaught TypeError: dgram.createSocket is not a function

I can´t fix this problem to create a UDP Socket in my project. i install dgram with npm. when i run : node app.js, works fine, but When a call this function in another class doesn´t work. Here is my code:

const dgram = require('dgram')
import React from 'react';

export default function read() {
const server = dgram.createSocket('udp4')

server.on('error',(error)=>{
    console.log('error')
server.close()
})



server.on('listening',()=>{
    const address = server.address()
    console.log('on')
})

server.on('message',(message,senderInfo)=>{

    console.log('recebido')
    server.send(message, senderInfo.port,senderInfo.address, ()=>{
    console.log('test')})
    

})

server.bind(5500)
}

this error apper:

UDPread.js:11

   Uncaught TypeError: dgram.createSocket is not a function
at read (UDPread.js:11:1)
at onClick (PressResponder.js:364:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
at invokeGuardedCallback (react-dom.development.js:4056:1)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4070:1)
at executeDispatch (react-dom.development.js:8243:1)
at processDispatchQueueItemsInOrder (react-dom.development.js:8275:1)
at processDispatchQueue (react-dom.development.js:8288:1)
at dispatchEventsForPlugins (react-dom.development.js:8299:1)
at react-dom.development.js:8508:1
at batchedEventUpdates$1 (react-dom.development.js:22396:1)
at batchedEventUpdates (react-dom.development.js:3745:1)
at dispatchEventForPluginEventSystem (react-dom.development.js:8507:1)
at attemptToDispatchEvent (react-dom.development.js:6005:1)
at dispatchEvent (react-dom.development.js:5924:1)
at unstable_runWithPriority (scheduler.development.js:468:1)
at runWithPriority$1 (react-dom.development.js:11276:1)
at discreteUpdates$1 (react-dom.development.js:22413:1)
at discreteUpdates (react-dom.development.js:3756:1)
at dispatchDiscreteEvent (react-dom.development.js:5889:1)

any solution?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!