question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sockets.createSocket undefined object

See original GitHub issue

Hi,

I am using your library this way:

import dgram from ‘react-native-udp’;

componentDidMount() {
    const socket = dgram.createSocket('udp4');
    socket.bind(12345, '0.0.0.0', function(){
        console.log('bound');
    });
  } 

I get this stacktrace:

[09:44:01] TypeError: undefined is not an object (evaluating 'Sockets.createSocket')

This error is located at:
    in HomeScreen (at App.js:23)
    in RCTView (at View.js:44)
    in App (at registerRootComponent.js:17)
    in RootErrorBoundary (at registerRootComponent.js:16)
    in ExpoRootComponent (at renderApplication.js:34)
    in RCTView (at View.js:44)
    in RCTView (at View.js:44)
    in AppContainer (at renderApplication.js:33)
- node_modules\react-native-udp\UdpSocket.js:61:10 in UdpSocket
- node_modules\react-native-udp\UdpSockets.js:11:23 in createSocket
* screens\HomeScreen.js:24:38 in componentDidMount
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:12144:10 in commitLifeCycles
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:13496:8 in commitAllLifeCycles
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:92:15 in invokeGuardedCallbackImpl
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:306:36 in invokeGuardedCallback
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:13702:8 in commitRoot
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:15269:13 in completeRoot
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:15197:21 in performWorkOnRoot
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:15090:24 in performWork
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:15047:14 in performSyncWork
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:14925:19 in requestWork
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:14711:16 in scheduleWork
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:7700:17 in enqueueSetState
- node_modules\react\cjs\react.development.js:364:31 in setState
* App.js:53:18 in _handleFinishLoading

The version that I am using are:

"@expo/samples": "2.1.1",
    "expo": "^31.0.2",
    "react": "16.5.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz",
    "react-native-udp": "^2.3.1",
    "react-navigation": "^2.18.2"

I followed your README during installation but when debugging your library I notice that in UdpSocket.js NativeModules.UdpSockets is undefined.

Can you please advice what to do?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mvayngribcommented, Nov 7, 2018

@faxe1008 sorry, I don’t really know enough to say. Btw, briefly skimming their docs, looks like they have detach, which is a bit less drastic

0reactions
mvayngribcommented, Feb 18, 2019

closing due to inactivity

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-udp Sochets.createSocket undefined object
[09:44:01] TypeError: undefined is not an object (evaluating 'Sockets.createSocket') This error is located at: in HomeScreen (at App.js:23) ...
Read more >
undefined is not an object (evaluating 'Sockets.createSocket')
Hi I got this error on IOS when starting up screen where RNU is located. react-native-cli: 2.0.1 react-native: 0.57.8. RNU is already linked...
Read more >
UDP/datagram sockets | Node.js v19.3.0 Documentation
The node:dgram module provides an implementation of UDP datagram sockets. import dgram from 'node:dgram'; const server = dgram.createSocket('udp4'); ...
Read more >
zmq — PyZMQ 25.0.0b1 documentation
A zmq Context creates sockets via its ctx.socket method. ... class MyClass(object): def __init__(self, context=None): self.context = context or ...
Read more >
16.20 - TPT01437 Error: Unable to create socket, System errno: %d ...
TPT01437 Error: Unable to create socket, System errno: %d(%s) Explanation: A TPT ... TPT01520 Error: Undefined catalog or catalog message, Error code %d, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found