now I try to develop the tcp chat server

So what I have done so far
-my server can only received string from the client
-My server can show the total of the connection

So what I want to ask
what do I need to do to make the server and all the other clients receive the message as well and the Server can choose to broadcast message to a single client or everyone.
plz give me some idea

make the server and all the other clients receive the message

The server could forward the message it receives to all the clients that are connected to it.
If there is a list of clients, you could have some selection criteria to choose which one(s) to send any message to.

So I need to have an array list?

I don't know what kind of collection would be best. An ArrayList could work.

When I put the all the connection into an array.Will it automatically forward to all of client ? Or I need a specific method to board cast the messages.

Nothing will be automatic. Your server code will need to search the list and decide which client(s) to send a message to. The list should have class objects that contain all the information you need to be able to send a message to a client.

Sound pretty hard to do it. Anyway thank you for your suggestion.

Start with a single client. Try to organize all the controlling data and references into one class.
When that works, Then add a second client. That will force you to implement a design for holding the data for each client.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.