communicate 2 users using sockets

Jul 12 2007 1:13 PM
Hi, I'm doing a chat program and I have 2 questions: 1. If the chat is a peer to peer program, I mean there is no "server" class", to communicate user A and user B, I have to: a. each user has to create one socket that will listen incomming connection b. when user A request to user B, user B create one new socket to establish connection between the two users and then they can send and receive messages IS THIS CORRECT? 2. If the chat has a "server" class that will communicate the users, the communication process will be like: a. the server class create a socket that accept incomming/outcomming connections b. each user create a socket to connect to the server class c. the server class is just like a "channel" to communicate the users IS THIS CORRECT? As yo can see, i´m trying to "draw" my application algorithm, thanks for your help Herbert