question about accepr() in network programming

I'm working on my homework to write a chatroom program. Different users can be on-line at the same and talk to each other.
I found that each time I invoked the accept function. A new socket was created. I don't how can I receive message from the client who is already on-line and send it to others.
Or I should use another function instead of accept.
Thank you for your help.:slight_smile: