I have two my app where in one will act as a server and another as a client.
The server waits for connections from clients and recieves files from the clients.
The file transfer is working fine.
But now as the server is only reciveing and client only sending, its just
one -way traffic. But I want to implement a disconnect from both sides.
Basically I want to send a command to the seding app from the recieving app so that both of them disconnect cleanly.
For this my idea is to toggle between send and recieve calls on the socket.
1) Is this possible in first place using sockets? Do I need TCP sockets or do I need to use UDP sockets?
2) How can I set a timeout on the recieve so that I just wait for some time
and later go back to the sending mode?
3) Also when I am not recieving but the other end is sending will the data
remain in my devices buffer till I do a recv?
Any ideas abt how to implement this?
You cannot rely that the mobile has a public IP adress, unless you want to limit yourself to certain operator and connection type. Most gprs networks are behind NAT, so you do not get incoming connection to the mobile
You may not be able to receive UDP for the forementioned reason.
I would suggest you to implement a polling client on the mobile and server on internet side.