l'unica cosa che implementano è il Serializable poichè devo fare una comunicazione client server.
Adesso sto provando a prendere un'altra strada,cioè il client richiede esplicitamente un oggetto al server(che conserve una lista contenente questi oggetti) il quale glielo manda, e poi vorrei salvare alcuni di questi oggetti in una lista nel client.Così dovrei essere tranquillo, però visto che ho un'eccezzione mi chiedo: è possibile mandare un oggetto(con tutti i suoi attributi) attraverso i socket?

per essere chiari vi faccio vedere come lo mando:
LATO CLIENT
codice:
public void aggiungi(){
try{
Socket s=new Socket("localhost",30001); ObjectOutputStream oos=new ObjectOutputStream(s.getOutputStream()); ObjectInputStream ois=new ObjectInputStream(s.getInputStream());
String titolo=JOptionPane.showInputDialog("Inserisci titolo brano:"); oos.writeObject(titolo);
oos.flush();
Brano b=(Brano)ois.readObject(); deejaygui.salvaScaletta(b);
}catch(UnknownHostException exc){System.out.println("Host sconosciuto!");} catch(Exception e){e.printStackTrace();} }
LATO SERVER
codice:
public void richiestaAggiungi(){
try{
ServerSocket ss=new ServerSocket(30001);
while(true){
Socket s=ss.accept();
System.out.println("connessione avvenuta!");
ObjectOutputStream oos=new ObjectOutputStream(s.getOutputStream());
ObjectInputStream ois=new ObjectInputStream(s.getInputStream());
String titolo=(String)ois.readObject();
synchronized(listaBrani){
for(Brano b:listaBrani){
if(b.getTitolo().equalsIgnoreCase(titolo)){
oos.writeObject(b);
oos.flush(); } } } } }catch(UnknownHostException e){System.out.println("Host unknown");} catch(Exception e){System.err.println(e);} }