Android Question handling multiport

Hi to all
I want to manage at least 8 different ports at the same time. I know how to handle one port by Network( and Asyncstream ) library. Is it possible to do it with this library? for example by listening to different ports every 50 miliseconds or it is against the aim of socket programming?
Thanks
 
one more question, is it possible to use an android device as a server and a client simultaneously? (by using Network library)
to be more clear, I want my android device work in two modes because
1-(as client) send some information to my php file in sever(in which it sends to some other clients after some processing)
2-(as server) to be sure that all those ones get my messages( knowing who get my messages and who don't)
please consult me
many thanks
 
Upvote 0
MQTT makes it very simple to implement communication between multiple devices. It is not really a server to client connection but rather clients to clients with very good control on everything.

Thanks a lot
I understood MQTT is the solution of remote client to client connections but as I implemented based on socket it's hard for me to change. I got an idea asking your opinion.
I would be grateful to you.
As we know the problem of connection between two clients which are not in the same network is that it's hard for us to find their IP address. what if we put their IP address in online database and tell both sides to give their new IP address to server every couple of hours? It's not the answer lonely because IP address may change just after sent to database by turning modem off/on, for example. Therefore, we need a check code to make sure if the destination client got the order or not, then we check the IP address again. logical code is like this:

while( you have IP address of destination)
send stuff to destination
if not(check code) then
get IP address from database
else
return true
end if
loop
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…