There's an app on my phone which binds dynamically to local ports over 31000(since my local port range is 31000 to somewhere around 60000). I want the application to bind on port 25 (smtp) because the port is not monitored or controlled by the network. I have searched the internet for methods to do this and I have come across the iptables method in which it said I must do port redirection but that's for servers.

Any help would be greatly appreciated.

  • 1
    The information you provided isn't enough to answer the question. Except that you are trying to bind to a port under 1024 which requires root privileges. But apps cannot run as root user. At maximum, on rooted devices, apps can run native processes with root privileges. Or you may write a special Java VM and execute it from commandline with root. Port forwarding/redirection is rather simple solution. – Irfan Latif Sep 25 '20 at 14:51
  • Yes my phome is rooted. Port redirection would work if i was running a server on my device but in my case the program does the selection and binding of ports. By Java VM do you mean Java virtual machine? How does that really work? I once thought that maybe tunnelling traffic from that app through an internal proxy server running on port 25 would work. Is the ingoing port of the proxy server the same as the outgoing of it to the remote server? Or is there another way i can mask the source port of the socket? – Silent Sep 26 '20 at 23:16

Your Answer

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

Browse other questions tagged or ask your own question.