FileDocCategorySizeDatePackage
PlayerListenerThread.javaAPI DocExample890Tue Dec 12 18:58:42 GMT 2000bingo.shared

PlayerListenerThread

public class PlayerListenerThread extends ListenerThread

Fields Summary
private PlayerListener
notifyee
Constructors Summary
public PlayerListenerThread(PlayerListener notifyee)


	super(Constants.PlayerListeningGroup);
	this.notifyee = notifyee;
    
Methods Summary
public synchronized voidrun()

	DatagramPacket packet;

        while (stopListening == false) {
	    byte[] buf = new byte[256];
            packet = new DatagramPacket(buf, 256);
	    try {
                socket.receive(packet);
		byte[] rcvd = packet.getData();
		final PlayerRecord p = new PlayerRecord(rcvd);
		SwingUtilities.invokeLater(new Runnable() {
		    public void run() {
	                notifyee.updatePlayer(p);
		    }
		});
	    } catch (IOException e) {
		    // PENDING: what goes in here?
	    }
        }