FileDocCategorySizeDatePackage
BallListenerThread.javaAPI DocExample832Tue Dec 12 18:58:42 GMT 2000bingo.shared

BallListenerThread

public class BallListenerThread extends ListenerThread

Fields Summary
private BallListener
notifyee
Constructors Summary
public BallListenerThread(BallListener notifyee)


	super(Constants.BallListeningGroup);
	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();
		BingoBall b = new BingoBall(rcvd);
		if (b.getNumber() == BingoBall.GAME_OVER) {
		    notifyee.noMoreBalls();
		} else
		    notifyee.ballCalled(b);

	    } catch (IOException e) {
		    // PENDING: what goes in here?
	    }
        }