operating sever client from same program

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.
Are you new to c/c++? I recommend you reading up on sockets.

http://www.linuxhowtos.org/C_C++/socket.htm

This should help you understand what you need to accomplish what you want.
i have already read the link. there is nothing pertaining to my query.
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.
Topic archived. No new replies allowed.