Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many port number that android and ios have?

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?

like image 988
Sam YC Avatar asked Sep 13 '12 08:09

Sam YC


1 Answers

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.

like image 61
paulgavrikov Avatar answered Oct 01 '22 12:10

paulgavrikov