I am working on a project it is like a chatting system over TCP/IP. Android users as Clients connect to server, server code is written in Python. I want to explain what actually my problem is clearly.
Say there are two clients (users) A and B.
When Both are connected to server, the sock.accept returns two soccket connection objects, say "Aconn" and "Bconn". like below
Aconn , Aaddress = sock.accept();
Bconn , Baddress = sock.accept();
So Now if I want to send a Message from A to B. then Server can forward received message from A to B easily as the object for B is available as "Bconn". we can send the message to B as below.
Bconn.send(datafromA);
Problem comes when B is not connected to server yet(Now Offline). B may connect to server in the future(Online). Now how to resolve this issue ? Is it possible to store that socket connection when users connect to server first time and assigning the same whenever they come online ? Any good solution? Thanks In advance