Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Most of this code is identical to the SimpleChatServer we made in the Networking and Threads chapter. The only difference, in fact, is that this server receives, and then re-sends, two serialized objects instead of a plain String (although one of the serialized objects happens to be a String).
import java.io.*; import java.net.*; import java.util.*; public class MusicServer { ArrayList<ObjectOutputStream> clientOutputStreams; public static void main (String[] args) { new MusicServer().go(); } public class ClientHandler implements Runnable { ObjectInputStream in; Socket clientSocket; public ClientHandler(Socket socket) { try { clientSocket = socket;