Hi!
Der Client-Code sieht ungefähr so aus:
Verbindung herstellen
Code:
void jButton1_actionPerformed(ActionEvent e) {
try {
socket = new Socket("localhost", 5190);
}
catch (IOException ex) {
ex.printStackTrace();
}
}
Objekt senden
Code:
void btnSend_actionPerformed(ActionEvent e) {
JPanel objekt = new JPanel();
objekt.setLocation(10,10);
try {
out = socket.getOutputStream();
oout = new ObjectOutputStream(out);
//ObjectOutputStream oout = socket.getOutputStream();
oout.writeObject(objekt);
//oout.writeObject(null);
}
catch (Exception ex) {
ex.printStackTrace();
}
}