FileDocCategorySizeDatePackage
SocketGate.javaAPI DocExample1330Tue Dec 12 18:58:42 GMT 2000bingo.game

SocketGate

public class SocketGate extends Object implements Constants

Fields Summary
private InetAddress
ballListeningGroup
private InetAddress
playerListeningGroup
private InetAddress
gameListeningGroup
private MulticastSocket
socket
Constructors Summary
SocketGate()


        

        socket = new MulticastSocket(Constants.portNumber);

        ballListeningGroup = InetAddress.getByName(Constants.BallListeningGroup);
        playerListeningGroup = InetAddress.getByName(Constants.PlayerListeningGroup);
        gameListeningGroup = InetAddress.getByName(Constants.GameListeningGroup);
    
Methods Summary
voidsendBall(BingoBall b)

        sendBytes(b.getBytes(), ballListeningGroup);
    
private voidsendBytes(byte[] data, java.net.InetAddress group)

        DatagramPacket packet = new DatagramPacket(data, data.length, group,
                                                   Constants.portNumber);
        try {
            socket.send(packet);
        } catch (java.io.IOException e) {
            // PENDING: what should go in here?
        }
    
voidsendGameStatusMessage(java.lang.String msg)

        sendBytes(msg.getBytes(), gameListeningGroup);
    
voidsendPlayerStatusMessage(PlayerRecord p)

        sendBytes(p.getBytes(), playerListeningGroup);