Now forcing the host resolution to happen, which will make the UnknownHostException fire if there are problems.
This commit is contained in:
Andy Prock 2015-12-21 17:19:59 -08:00
parent bf668cd322
commit 641b9d770e

View File

@ -74,7 +74,7 @@ public final class UdpSocketClient implements UdpReceiverTask.OnDataReceivedList
SocketAddress socketAddress; SocketAddress socketAddress;
if (address != null) { if (address != null) {
socketAddress = new InetSocketAddress(address, port); socketAddress = new InetSocketAddress(InetAddress.getByName(address), port);
} else { } else {
socketAddress = new InetSocketAddress(port); socketAddress = new InetSocketAddress(port);
} }
@ -157,7 +157,7 @@ public final class UdpSocketClient implements UdpReceiverTask.OnDataReceivedList
UdpSenderTask task = new UdpSenderTask(mSocket, this); UdpSenderTask task = new UdpSenderTask(mSocket, this);
UdpSenderTask.SenderPacket packet = new UdpSenderTask.SenderPacket(); UdpSenderTask.SenderPacket packet = new UdpSenderTask.SenderPacket();
packet.data = data; packet.data = data;
packet.socketAddress = new InetSocketAddress(address, port); packet.socketAddress = new InetSocketAddress(InetAddress.getByName(address), port);
if (callback != null) { if (callback != null) {
synchronized (mPendingSends) { synchronized (mPendingSends) {