tradle / react-native-udp

node's dgram for react-native
MIT License
339 stars 154 forks source link

Difference between standard run and remote-debug run? #39

Closed cchance27 closed 5 years ago

cchance27 commented 7 years ago

I'm going nuts here was working on getting some snmp working and it was working fine, then i disabled the IOS remote-debugger and its crashing out, i'm using net-snmp for snmp via udp, i swapped to net-snmp, because oddly enough the npm module i switched from (snmp-native) after going back to it i had a similar issue, with things working (after some hacking of the module) with remote-debugger enabled but as soon as you disabled it it would bomb out to red screen

net-snmp module worked out of the box, while remote debug was enabled... then i ran it without remote-debug using log-ios instead, and red screen of death!

It's like somehow the UDP packets the app are receiving are different between when the app has Remote-Debug enabled and when its just running in the emulator

For instance with remote-debug enabled the SNMP request processes fine, with it disabled and using react-native log-ios i get....

: Community 'public' in request does not match community '0��public��q So it appears for some reason with remote-debug disabled the udp messages are garbled
mvayngrib commented 7 years ago

hm, my first thought is that somewhere someone did buffer.toString() when the buffer contents weren't a utf8 string. For background, the react native bridge (javascript<=>native) doesn't support sending binary data, so this module converts all UDP packets to base64 and back when traveling from and to iOS/Android. Does that help?

cchance27 commented 7 years ago

Well i'd imagine it has to do with the ASN1 conversion that reads the Udp hex and converts it to Text, what i dont get from your explanation is why it would differ based on if remote-debug is enabled or not (monitoring via chrome debug or not) ...

also if the react-native-udp bridge is handling binary ->.base64 -> binary, wouldn't this mean the error is in the bridge, because to apps using the RN-UDP it should still appear as binary and somehow enabling/disabling remote-debug is breaking that binary-b64-binary translation?

On 17 February 2017 at 11:23, Mark Vayngrib notifications@github.com wrote:

hm, my first thought is that somewhere someone did buffer.toString() when the buffer contents weren't a utf8 string. For background, the react native bridge (javascript<=>native) doesn't support sending binary data, so this module converts all UDP packets to base64 and back when traveling from and to iOS/Android. Does that help?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tradle/react-native-udp/issues/39#issuecomment-280678658, or mute the thread https://github.com/notifications/unsubscribe-auth/ANIO10WWsg5P_bjyBJmsPzPuzJna7-O3ks5rdbtZgaJpZM4MEWTB .

cchance27 commented 7 years ago

So it's definitely something wrong in the ios version of the bridge, as on android it works with same exact code and modules, i tried to look at it but i honestly don't know anywhere near enough about the bridge or native code to debug it :( any chance you could take a look as theirs something going on different between ios and android, and on ios its odd how it works when the chrome remote debugger is open for me :S

On 17 February 2017 at 12:14, Chris Chance cchance@gmail.com wrote:

Well i'd imagine it has to do with the ASN1 conversion that reads the Udp hex and converts it to Text, what i dont get from your explanation is why it would differ based on if remote-debug is enabled or not (monitoring via chrome debug or not) ...

also if the react-native-udp bridge is handling binary ->.base64 -> binary, wouldn't this mean the error is in the bridge, because to apps using the RN-UDP it should still appear as binary and somehow enabling/disabling remote-debug is breaking that binary-b64-binary translation?

On 17 February 2017 at 11:23, Mark Vayngrib notifications@github.com wrote:

hm, my first thought is that somewhere someone did buffer.toString() when the buffer contents weren't a utf8 string. For background, the react native bridge (javascript<=>native) doesn't support sending binary data, so this module converts all UDP packets to base64 and back when traveling from and to iOS/Android. Does that help?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tradle/react-native-udp/issues/39#issuecomment-280678658, or mute the thread https://github.com/notifications/unsubscribe-auth/ANIO10WWsg5P_bjyBJmsPzPuzJna7-O3ks5rdbtZgaJpZM4MEWTB .

mvayngrib commented 7 years ago

@cchance27 could you push your project with the reproducible error? I'll try to make time to look at it.

zi6xuan commented 5 years ago

I have the same error,do you fix it? friend!

zi6xuan commented 5 years ago

I fix it,just see this

If you want to send and receive node Buffer objects, you'll have to "npm install buffer" and set it as a global for UdpSockets to pick it up:

global.Buffer = global.Buffer || require('buffer').Buffer

you must install the buffer module

mvayngrib commented 5 years ago

closing due to inactivity