At starting point you have to program two sides of this program
one part is of Server and another is client.
So lets Get Started
This one is for Server End place in on static or in jbuttonAction Performed
ServerSocket serverSocket = new ServerSocket(8080);
Socket socket = serverSocket.accept();
PrintWriter writer = new PrintWriter(socket.getOutputStream());
String advice = “here is your message to send to client”
System.out.println("Sending advice: " + advice);
That’s it Now for Client Side
System.out.println("Getting some good advice...");
Socket socket = new Socket("localhost", 8080);
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String advice = reader.readLine();
System.out.print("Whoops! It didn't work!\n");
Here it goes Now run the server Code First and then the Client Code Thats it.