Reputation: 290
First of all, it works locally. The issue happens only when I upload my code to Heroku. I can see in my logs that the server is working fine, and it's simply not receiving socket data through UDP. Creating the socket:
DatagramSocket socket;
try {
socket = new DatagramSocket(port);
} catch (Exception e) {
logger.error(e.toString());
}
Listening for packets:
try {
byte[] data = new byte[256];
DatagramPacket receivePacket = new DatagramPacket(data, data.length);
socket.receive(receivePacket);
logger.log("Got packet!"); // This is never reached
} catch (IOException e) {
logger.log(e.toString());
}
I tried connecting to the server (through mac) by running netstat: nc -u garbil.herokuapp.com 40791
, but it simply doesn't work.
The server logs can be viewed in http://garbil.herokuapp.com/logs.
Upvotes: 2
Views: 505
Reputation: 5411
Well i guess this is a firewall issue :)
You need to check that you configured well the "PORT" var : https://devcenter.heroku.com/articles/dynos#web-dynos
Then you also might have to check that the provider allow you to use UDP...
Upvotes: 1