I have a client/server application thatis very similar to a chat program where
the SERVER will need to send messages to a specific CLIENT.

The problem is that I do not know how to get an ID or THREAD ID for the ClientWorker
class after it is started.

IF you have any tips I would appreciate it!



HEre is my code so far:

package multiserver;

import java.net.*;
import java.io.*;
import java.lang.String;

class ClientWorker implements Runnable
public ClientWorker (Socket socket){
System.out.println("You are now in CLIENT WORKER");


public void run()


public class MultiServer {
boolean serverListening = true;
ServerSocket serverSocket = null;

public MultiServer() {
System.out.println("Starting Khrondar Multicast Server..");
// Start Server, obtain PORT, obtain INET Address //
try {
serverSocket = new ServerSocket(4444);
System.out.println("PORT resolved at [" + serverSocket.getLocalPort()
+ "]");
System.out.println("INET address resolved at [" + serverSocket.getInetAddress()
+ "]");
} catch (IOException e) {
System.err.println("Khrondar Multicast Server could not listen
on port: 4444.");

System.out.println("Khrondar Multicast Server instantiated.");
System.out.println("Starting Khrondar Multicast Socket Listener.");

while (serverListening)
try {
new ClientWorker(serverSocket.accept());
} catch (IOException io) {
public static void main(String[] args) {
MultiServer server = new MultiServer();