Skip to content

Commit

Permalink
Removing blocking function
Browse files Browse the repository at this point in the history
This fixes tradle#47
The ´InetAddress.getHostName()´ blocks and does not resolve if there is no DNS server (example using an IOT device in AP mode, e.g. ESP8266), so I'm changing it to ´InetAddress.getHostAddress()´ as it is non-blocking.
  • Loading branch information
cristovao-trevisan authored Sep 26, 2017
1 parent cfcb081 commit a0c4ddb
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected Void doInBackground(Pair<DatagramSocket, UdpReceiverTask.OnDataReceive
final InetAddress address = packet.getAddress();
final String base64Data = Base64.encodeToString(packet.getData(), packet.getOffset(),
packet.getLength(), Base64.NO_WRAP);
receiverListener.didReceiveData(base64Data, address.getHostName(), packet.getPort());
receiverListener.didReceiveData(base64Data, address.getHostAddress(), packet.getPort());
} catch (IOException ioe) {
if (receiverListener != null) {
receiverListener.didReceiveError(ioe.getMessage());
Expand Down

0 comments on commit a0c4ddb

Please sign in to comment.