SocketGatepublic 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 |
---|
void | sendBall(BingoBall b)
sendBytes(b.getBytes(), ballListeningGroup);
| private void | sendBytes(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?
}
| void | sendGameStatusMessage(java.lang.String msg)
sendBytes(msg.getBytes(), gameListeningGroup);
| void | sendPlayerStatusMessage(PlayerRecord p)
sendBytes(p.getBytes(), playerListeningGroup);
|
|