UDP plugin with iOS


I am using this udp plugin to connect my app with another device. The plugin works well with Android, but i have found it doesn’t fully work with iOS.

With iOS, i can’t get past below in the code, which occurs after the bind operation completes successfully.


onReceive events are raised when UDP packets arrive on the address/port specified.
The function UDPonReceive is never called. Does the listener code need to be modified for iOS?


You might also try asking the maintainer or opening an issue:

This plugin hasn’t been updated in 5 years, and is still listed as Beta.

We decided to try some of the other UDP apps.
We’re having a lot of trouble getting Apple phones to work with any of the available UDP plugins so far. It always works with Android but get errors for Apple.
For example, i get this error when i press Button1 as below using an iPhone (using https://www.npmjs.com/package/cordova-plugin-socket-tcp)
Error connecting - [NSTaggedPointerString stringValue]: unrecognised selector sent to instance 0x98a6c4a0c5d57b

and the code is below (need to press button 1)

var socket; 
document.addEventListener("deviceready", Main2, false);
function Main2()

Button1.onclick = function()
     if(typeof(cordova) != "undefined")  //running in PhoneGap
            socket = new Socket();            
            socket.open(ipadd.value, portval.value, GG1, GG2); 
     else  //running in browser
           NSB.MsgBox("Running in browser")

function GG1()
    Label1.value = "Successfully connected";  
    socket.onData = function(data) {
       // invoked after new batch of data is received (typed array of bytes Uint8Array)
       //NSB.MsgBox("onData - " + JSON.stringify(data))  
       Label1.value = "onData - " + JSON.stringify(data);
    socket.onError = function(errorMessage) {
       // invoked after error occurs during connection
       //NSB.MsgBox("onError - " + JSON.stringify(errorMessage))  
       Label1.value = "onError - " + JSON.stringify(errorMessage);
    socket.onClose = function(hasError) {
       // invoked after connection close
       //NSB.MsgBox("onClose - " + JSON.stringify(hasError))  
       Label1.value = "onClose - " + JSON.stringify(hasError);

function GG2(errorMessage)
    Label1.value = "Error connecting -   " + JSON.stringify(errorMessage);

With android, i get “Successfully connected”.

Does Apple need some special treatment in the config file or something else?
I couldn’t get onReceive calls to work with another plugin but it works with android.

Greatly appreciate any help.

You might try opening an issue on the GitHub repo for the plugin. If the plugin is being maintained, the author of the plugin may have an answer.