i want to make a single program for operating both server & client. i want my program to run in such a way that when program is launched, server should start listening for requests from other machines. but when i want to send data to other machines, my server should quit & client is launched so that i start sending data. once complete data has been transferred by client, it should quit & come back to server mode.
Any suggestion on whether its feasible. if yes, then how.
I don't think that it would be possible for server to "quit". Having said that, you can still have just one binary to contain both server and client code. Just use some command line switches to activate server or client. You have to have a server up for client to send data.