mirror of
https://github.com/status-im/react-native-udp.git
synced 2025-01-12 18:14:13 +00:00
Fixes #14
Now forcing the host resolution to happen, which will make the UnknownHostException fire if there are problems.
This commit is contained in:
parent
bf668cd322
commit
641b9d770e
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user