[TIMOB-20169] Ti.UDP module, broadcast doesn't work
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | n/a |
| Reporter | nicolomonili |
| Assignee | Unknown |
| Created | 2015-09-08T09:24:27.000+0000 |
| Updated | 2018-02-28T19:55:54.000+0000 |
Description
Ti.UDP 1.2.0 : https://github.com/appcelerator-modules/ti.udp/releases/tag/ios-1.2.0
Question on Q&A : https://developer.appcelerator.com/question/163579/broadcast-of-udp-module-for-ios-not-working
Issue on Github: https://github.com/appcelerator-modules/ti.udp/issues/4
This code doesn't work for broadcast messages :
var socket = UDP.createSocket();
socket.start({
port: ...
});
socket.sendBytes({
data: [....,....]
});
socket.close();
If i add the host , the message is sent. But it's not correct for broadcast messages
var socket = UDP.createSocket();
socket.start({
port: ...
});
socket.sendBytes({
host : "...",
data: [....,....]
});
socket.close();
*UPDATE 1*
- I "solved" the problem of the broadcast message in this way
var socket = UDP.createSocket();
socket.start({
port: ...
});
socket.sendBytes({
host : "239.255.255.250",
data: [....,....]
});
socket.close();
*UPDATE 2*
- The *Ti.UDP 1.2.0* doesn't seem to work on Android
adding https://gist.github.com/chancyWu/8349411#file-send-and-receive-a-broadcast-udp-packet-in-c-or-objective-c-L16 worked with 255.255.255.255