Comments (9)
Did you bind the port before sent the message?
from cordova-plugin-chrome-apps-sockets-udp.
I tried it both with and without binding the socket without send, neither worked.
If I bind the socket before send, it works (except for the receive), but it gives me an iOS error in the console saying that the port cannot be bound mpre than once.
from cordova-plugin-chrome-apps-sockets-udp.
What's the current status of this issue?
I'm facing similar problems, my Cordova app doesn't receive UDP messages when running on an iDevice. Chrome app works fine.
from cordova-plugin-chrome-apps-sockets-udp.
It turned out that I was sending with the UDP socket before it was properly initialized. I created a promise that resolves after the initialization (chrome.sockets.udp.create
function) and do all the sends after that promise is resolved. After that it works fine, so it was a problem with my code. I'm binding the socket to "0.0.0.0" and port 0 (auto-select) before sending data through it.
from cordova-plugin-chrome-apps-sockets-udp.
Thanks, @Kobzol.
It turned out that the root cause of my problem was slightly different from yours, but your suggestions definitely helped me squashing my bug.
from cordova-plugin-chrome-apps-sockets-udp.
I'm having problems with receiving UDP sockets on iOS.
I create a socket on iPhone, send a message, the other side receives it and sends a response to the phone's address (IP, port), but the callback registered with onReceive doesn't fire.
The same code works without problems on Android.
I tried setting the socket as persistent, that didn't help.
Is there anything extra that has to be done for this to work?
Have you found the solution?I have a exact same problem.. HELP!
from cordova-plugin-chrome-apps-sockets-udp.
I described the solution in a comment above (#9 (comment)). I was using the socket before it was initialized, you need to make sure that everything happens only after all callbacks are processed (initialization, port bind etc.). I also had some issues with broadcast, for that I needed to enable the broadcast flag on the socket.
from cordova-plugin-chrome-apps-sockets-udp.
I described the solution in a comment above (#9 (comment)). I was using the socket before it was initialized, you need to make sure that everything happens only after all callbacks are processed (initialization, port bind etc.). I also had some issues with broadcast, for that I needed to enable the broadcast flag on the socket.
But in my android device it is working perfectly. Here is my code.
code flow does not go in the onReceive method in ios
from cordova-plugin-chrome-apps-sockets-udp.
If you're setting the port to 0, that means that you can only pretty much receive broadcast packets (otherwise the other side wouldn't know which port to send to). In that case you have to enable broadcast (chrome.sockets.udp.setBroadcast(sockId, true, callback)
) and only bind after the broadcast is enabled.
from cordova-plugin-chrome-apps-sockets-udp.
Related Issues (20)
- Internet required? HOT 1
- Cannot receive multiple parallel packets by discovery broadcast HOT 1
- cannot read property 'sockets' of undefined in ionic
- Ionic with UDP client with Cordova Plugin
- Permission denied to sendBroadcast HOT 2
- receive udp packet data field is null HOT 2
- Plugin build failure HOT 1
- setBroadcast but nothing is received
- "send" is no response in ionic HOT 1
- beta status question HOT 1
- ionic2 working example
- Unable to use it with Phonegap: HOT 1
- how to determine broadcast IP?
- Cannot send UDP packet HOT 3
- Unhandled exception if no internet access is active
- how to install? HOT 2
- iOS 14 UDP Sockets not working correctly
- UDP socket not receiving multicast
- cordova app chrome not defined HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-chrome-apps-sockets-udp.