Regarding udp communication on Android devices

Asked 1 years ago, Updated 1 years ago, 116 views

I am creating an application that communicates udp packets using global ip on andoid terminals.Currently, packets can be communicated between terminals in a local environment using local ip.However, it is not possible to receive packets between global groups globally.The code is referenced below.
https://systembash.com/a-simple-java-udp-server-and-udp-client/
We do port mapping (port release) on the router and assign static ip to Android terminals.
By the way, when I ran the above program with pc, I was able to communicate globally.
Please let me know if there is anything else that you have overlooked in terms of the environment, other than a code error.

The following is my environment.
mobile terminal:Zenfone2
Android version: 6.01 (API level 23)
security applications:security master
routers:IODATA (WN-AG450DGR)

Supplemental
As Masm said, the connection between the terminal and the router is as follows.
Terminal--(Wi-Fi)--Router--(Internet)--Router--(Wi-Fi)--Terminal
I plan to specify the global ip and port number to have them communicate.

According to the network monitoring application (netswiss tool free), there is no problem when using local ip, but when using global ip, the port is closed.

Dear Sayuri, It is bidirectional; both ends are moving the sending and receiving threads of packets separately.Currently, packet communication is working properly when using local ip

I have confirmed the following points.
·There is no cover for the port number
·The specified ip and port numbers are correct
·I have given AndroidmManifest.xml internet permission to handle the network

Dear masm, We decided that the port was closed because of the following results:
When local ip is specified:
portscantcp (the router also releases tcp)
→ Results opened
udp flood
→Application operation
When global ip is specified:
portscantcp
→closed
udp flood
→Application does not work
この I used this network monitoring app to udp flood the above sample program port started on pc, and it worked well.

Supplement 2
The sender of the packet with global ip is successful.
作成 Because I was able to receive it from the application I was creating on the server of the above sample program started with pc.

android udp

2022-09-29 22:23

1 Answers

I don't know the exact cause, but the results are as follows.

·Failed to send and receive
- Global ip specification
Terminal a--(Wi-Fi)--Router a--(Internet)--Router a--(Wi-Fi)--Terminal a

·Successful transmission and reception
- Global ip specification
Terminal a--(Wi-Fi)--Router a--(Internet)--Router a--(Wi-Fi)--Terminal b

- Local ip specification
Terminal a--(Wi-Fi)--Router a--(Wi-Fi)--Terminal a

Terminal a--(Wi-Fi)--Router a--(Wi-Fi)--Terminal b

First of all, I was wondering if I could send and receive messages on my device, so I was stuck in a pot.

Thank you Masm and Sayuri for your comments.


2022-09-29 22:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.