|can a client run without a server?|
Not really. Your connection to the server will fail in connect(). What you do then is up to you.
|when i click the button the server runs and then all waiting clients can connect?|
Well, yes. The clients ought to be able to connect once you run the server.
Each time a client connects, accept() in the server will return a socket and the address of the client. You need to store these together and maintain a list of connected clients. You'll need the socket to talk to the client, but you'll also have the addresses for your dialog.
|can you give me source code or link some tutorials to do this?|
Not really, I don't have any to hand. BeeJ's guide ought to be sufficient.
|I have never used MFC before|
The complication is that a traditional Unix server sits around waiting for someone to connect in on a file descriptor.
A traditional GUI sits around waiting for some kind of message to arrive. So they're similar in that they're both sitting around waiting for something to happen.
There has been some effort to make a socket event look like a normal Windows event so they can be handled in the same way. That's the WinSock Async interface. Don't use it, it's a waste of everyones time.
I recommend you create a separate thread and run the server there. If the server needs to communicate with the GUI, it can construct a Windows message and send it using PostThreadMessage(). Sorry again, I don't have an example to hand.