0

Is it possible to edit list of reserved ports on Android (0 - 1023) to move lower port (under 1024) to higher port (equal or above 1024).

My mobile phone is rooted and I want to use lower port.

One option can be to reboot device so that to kill the process using some specific lower port.

Does Android provide any file in system files with table of reserved ports for edit?

1

Ports are not reserved by Android (or by any other OS) but are assigned by IANA for specific use. If a port is free i.e. no process is connected to or listening on that, you may use that with your program. But this may break the app's functionality for which the port is reserved. Otherwise you'll have to modify the source code and rebuild all the programs that are using a fixed port. It doesn't seem logical and practically possible.

For instance UDP port 68 is reserved for DHCP clients and the same is on Android:

# ss -up
Recv-Q  Send-Q   Local Address:Port   Peer Address:Port
0       0         192.168.1.11:68      192.168.1.1:67      users:(("system_server",pid=4521,fd=249))

So if you want to use this port for your program, your will have to modify Android source code to replace all instances of port 68 with some other unused port and then rebuild the ROM.
However you are free to use it when device is not connected to some network through WiFi or mobile data which obviously doesn't make much sense. Or you can configure static IP, Gateway and DNS so that DHCP is no more needed and the port gets free for other usage.

Further reading: 1 2 3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.