// Der Serverimport java.io.*;import java.net.*;import java.util.Scanner;public class Server { private ServerSocket sock; public Server(int port) { try{ sock = new ServerSocket(1234); System.out.println("Der Server ist gestartet!"); System.out.println("warten auf Client..."); }catch (IOException e){ System.out.println(e); System.exit(1); } Socket client = null; try{ while(true){ client = sock.accept(); PrintStream out = new PrintStream(client.getOutputStream(), true); Scanner scIn = new Scanner(System.in); System.out.println("Bitte geben sie den Sendetext ein:"); out.print(scIn.nextLine()); out.close(); client.close(); } }catch (IOException e){ System.out.println(e); System.exit(1); } } public static void main(String[] args) { Server myServer = new Server(1234); } }// Der Clientimport java.io.*;import java.net.*;public class Client { public Client(String hostName, int port) { try{ while(true){ Socket connection = new Socket(hostName,port); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); System.out.println(in.readLine()); in.close(); } }catch (IOException e){ System.out.println(e); System.exit(1); } } public static void main(String[] args) { Client myClient = new Client("localhost",1234); } }