Open classictoni opened 6 years ago
I found a solution that works, when binding the socket before sending data (from receiving data example):
var socketId;
// Handle the "onReceive" event.
var onReceive = function(info) {
if (info.socketId !== socketId)
return;
console.log(info.data);
};
// Create the Socket
chrome.sockets.udp.create({}, function(socketInfo) {
socketId = socketInfo.socketId;
// Setup event handler and bind socket.
chrome.sockets.udp.onReceive.addListener(onReceive);
chrome.sockets.udp.bind(socketId,
"0.0.0.0", 0, function(result) {
if (result < 0) {
console.log("Error binding socket.");
return;
}
chrome.sockets.udp.send(socketId, arrayBuffer,
'127.0.0.1', 1337, function(sendInfo) {
console.log("sent " + sendInfo.bytesSent);
});
});
});
For me this code does not work I checked everything the plugin is installed but it does not work
If you have a solution, tell me, thank you in advance
Hi, I am trying to send a UDP packet from my Android device. My code looks as follows:
Why isn't it sending anything?
AndroidManifest.xml
I have<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
I am using