Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Visitor
fandroide
Posts: 1
Registered: ‎04-21-2014
My Device: Blackberry Curve
My Carrier: ONO

UDP through BES (Blackberry Enterprise Server 5)

Hi everyone,

 

I'm developing an application which uses UDP in the client and server and tries to send packets via 3G. The server is deployed in a BES machine. I'm having problems reaching my server, I' m using Node.js for it. The issue is that I can't receive any packet when I try to send. If I use the host public address in the connector it works, but the problem comes when I use the internal IP address for the BES host .

 

I don't know where the problem is. I don't know if I have to specify an APN for the BES or something similar. Here's the way I create the connector, using my service provider APN , in this case Vodafone:

 

private UDPDatagramConnection_conn;

_conn = (UDPDatagramConnection)Connector.open("datagram://192.168.204.105:3001;apn=ac.vodafone.es;tunnelauthusername=vodafone");

 

If you want, you can try what I'm saying with UDPDemo from the Eclipse Plugin for Blackberry:

 

https://github.com/blackberry/JDE-Samples/tree/master/com/rim/samples/device/udpdemo

 

And here's a Node.js server sample code to check if packets are received:

 

var dgram = require("dgram");
var server = dgram.createSocket("udp4");

var PORT = 3001;
var HOST = "192.168.204.105";

server.on("error", function (err) {
console.log("server error:\n" + err.stack);
server.close();
});

server.on("message", function (msg, rinfo) {

var mess = msg.toString();

console.log(mess);


if(mess.indexOf("SERVER")!==-1){

var answer = new Buffer("OK");
server.send(answer,0, answer.length,rinfo.port, rinfo.address);
}

});


server.on("listening", function () {
var address = server.address();
console.log("servidor escuchando " + address.address + ":" + address.port);
});

server.bind(PORT,HOST);


Please any help would be appreciated.

Thank you very much.

Please use plain text.