Merge pull request #41 from aprock/master
fix #39 remove reverse dns lookup
This commit is contained in:
commit
75afd35a6b
|
@ -21,6 +21,7 @@ import com.facebook.react.bridge.WritableMap;
|
||||||
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.InetAddress;
|
||||||
import java.net.Inet6Address;
|
import java.net.Inet6Address;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
@ -160,10 +161,12 @@ public final class TcpSockets extends ReactContextBaseJavaModule implements TcpS
|
||||||
WritableMap infoParams = Arguments.createMap();
|
WritableMap infoParams = Arguments.createMap();
|
||||||
infoParams.putInt("id", clientId);
|
infoParams.putInt("id", clientId);
|
||||||
|
|
||||||
|
final InetAddress address = socketAddress.getAddress();
|
||||||
|
|
||||||
WritableMap addressParams = Arguments.createMap();
|
WritableMap addressParams = Arguments.createMap();
|
||||||
addressParams.putString("address", socketAddress.getHostName());
|
addressParams.putString("address", address.getHostAddress());
|
||||||
addressParams.putInt("port", socketAddress.getPort());
|
addressParams.putInt("port", socketAddress.getPort());
|
||||||
addressParams.putString("family", socketAddress.getAddress() instanceof Inet6Address ? "IPv6" : "IPv4");
|
addressParams.putString("family", address instanceof Inet6Address ? "IPv6" : "IPv4");
|
||||||
|
|
||||||
infoParams.putMap("address", addressParams);
|
infoParams.putMap("address", addressParams);
|
||||||
eventParams.putMap("info", infoParams);
|
eventParams.putMap("info", infoParams);
|
||||||
|
@ -172,17 +175,19 @@ public final class TcpSockets extends ReactContextBaseJavaModule implements TcpS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnect(Integer id, InetSocketAddress address) {
|
public void onConnect(Integer id, InetSocketAddress socketAddress) {
|
||||||
if (mShuttingDown) {
|
if (mShuttingDown) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WritableMap eventParams = Arguments.createMap();
|
WritableMap eventParams = Arguments.createMap();
|
||||||
eventParams.putInt("id", id);
|
eventParams.putInt("id", id);
|
||||||
|
|
||||||
|
final InetAddress address = socketAddress.getAddress();
|
||||||
|
|
||||||
WritableMap addressParams = Arguments.createMap();
|
WritableMap addressParams = Arguments.createMap();
|
||||||
addressParams.putString("address", address.getHostName());
|
addressParams.putString("address", address.getHostAddress());
|
||||||
addressParams.putInt("port", address.getPort());
|
addressParams.putInt("port", socketAddress.getPort());
|
||||||
addressParams.putString("family", address.getAddress() instanceof Inet6Address ? "IPv6" : "IPv4");
|
addressParams.putString("family", address instanceof Inet6Address ? "IPv6" : "IPv4");
|
||||||
|
|
||||||
eventParams.putMap("address", addressParams);
|
eventParams.putMap("address", addressParams);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "react-native-tcp",
|
"name": "react-native-tcp",
|
||||||
"version": "3.2.0",
|
"version": "3.2.1",
|
||||||
"description": "node's net API for react-native",
|
"description": "node's net API for react-native",
|
||||||
"main": "TcpSockets.js",
|
"main": "TcpSockets.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in New Issue