Socket echoSocket = new
Socket("my_machine_name",3000);
FileOutputStream fout = new
FileOutputStream("name.out");
// ObjectInputStream ois = new
ObjectInputStream(fout);
ObjectOutputStream dat = new
ObjectOutputStream(fis);
dat.writeObject(echoSocket);
The socket will be serialized and written into a file
named name.out.