well, if it works on the same computer, does that that must be using some kind of networking between the dealer server and the player clients already ?
multicast sockets are for the most part a UDP socket, with the IP address one of the class D designated addresses within the multicast address space 224.0.0.0 - 239.255.255.255, and using the java.net.MulticastSocket for client and server. the idea to make everything be in the same group is to use the same address for client and server.
For sending message numbers, you would need to do this in the message that you are transferring, such as the dealer server could send a class
|
Code:
|
public class Message implements Serializable {
int messageNumber;
String messageType;
String messageData;
// and the getters and setters for this property
} |
where the dealer server would generate the message number from a sequence and build a message bean, and serialize it out to to the multicast socket.
all of the clients would deserialize the message bean to extract its contents.
Multicast programming is a bit confusing at first because in this example we are not following the request / response message object paradigm usually found in client-server network programming.
But a good place to start if you already have the game working and need to bolt in the multicast messaging from the dealer server would be to create a few stand-alone junit or other test cases, that just boots up the multicast sockets in a server (sender) and sends out test messages typical of what it would in the game (such as sleep for a couple seconds, generate a "ping" message, and then have a test client to just receive these packets from the multicast sockets and de-serializing the messages.
Then when you iron out the kinks with the messaging operation, it should be more natural to integrate this into the poker application.