Skip to content

Commit cd3759a

Browse files
authored
fix(Android): Fix remoteAddress not returning IP (#111)
1 parent 991af02 commit cd3759a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

android/src/main/java/com/asterinet/react/tcpsocket/TcpSocketModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public void onConnect(Integer id, TcpSocketClient client) {
265265

266266
connectionParams.putString("localAddress", socket.getLocalAddress().getHostAddress());
267267
connectionParams.putInt("localPort", socket.getLocalPort());
268-
connectionParams.putString("remoteAddress", remoteAddress.getHostName());
268+
connectionParams.putString("remoteAddress", remoteAddress.getAddress().getHostAddress());
269269
connectionParams.putInt("remotePort", socket.getPort());
270270
connectionParams.putString("remoteFamily", remoteAddress.getAddress() instanceof Inet6Address ? "IPv6" : "IPv4");
271271
eventParams.putMap("connection", connectionParams);
@@ -330,7 +330,7 @@ public void onConnection(Integer serverId, Integer clientId, Socket socket) {
330330

331331
connectionParams.putString("localAddress", socket.getLocalAddress().getHostAddress());
332332
connectionParams.putInt("localPort", socket.getLocalPort());
333-
connectionParams.putString("remoteAddress", remoteAddress.getHostName());
333+
connectionParams.putString("remoteAddress", remoteAddress.getAddress().getHostAddress());
334334
connectionParams.putInt("remotePort", socket.getPort());
335335
connectionParams.putString("remoteFamily", remoteAddress.getAddress() instanceof Inet6Address ? "IPv6" : "IPv4");
336336

0 commit comments

Comments
 (0)