In article <ce6b7a31-b156-4ec6-a33a->,
Majid Dehghan <> wrote:
> much appreciated Jim Gibson,
> but you see ("# Handle a connection. Register the new user, and broadcast a
> message # to whoever is already connected.")
> i don't want that,i just want to send a message from one user to only another
> one,not all connected client.
> i googled it too,but i need someone to guide me
You need a way for clients to identify themselves to each other and to
the server. Then, the client needs to specify to which other client his
message will be sent. Then, instead of sending each incoming message to
all clients, you send it to only the client specified by the sender.
When a client connects, you should still probably send out a message to
all clients informing them that a new client has joined the service, is
ready to receive messages, and what their "handle" is. You will also
have to send the new client the list of existing clients.
--
Jim Gibson
|