I have tried google, but cannot even see a post talk about this. When I want to create socket in android, is the same rule of how we create socket in PC apply to android? Program listening at one port and wait to create socket?
You have a ServerSocket
and a Socket
. Call Socket client = ss.accept()
to wait until a client hooks in. Ff you are not sure which port is free just use ss = new ServerSocket()
. This will automatically assign an free port. Also make sure you don't do this on the main Thread and declare the according permissions in your manifest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With