package client; /** * @author berdan */ import utils.Message; import java.net.*; import java.io.*; import java.text.SimpleDateFormat; import java.util.Date; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.format.FormatStyle; public class Client1 { public Client1() throws IOException, ClassNotFoundException { Socket socket = new Socket( "localhost", 1236 ); ObjectOutputStream oboust = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream obinstr = new ObjectInputStream(socket.getInputStream()); Message senden = new Message( "berdan", "test" ); System.out.println(senden); // Message senden oboust.writeObject(senden); oboust.flush(); // Message erhalten Object erhalten = null; while(erhalten==null){ erhalten = obinstr.readObject(); } System.out.println(erhalten); oboust.close(); obinstr.close(); } public static void main(String args[]) throws IOException, ClassNotFoundException { new Client1(); } }