Multicast chat program
843790Feb 2 2007 — edited Feb 4 2007Hi,
The problem I am having is when checking to see if two specific users are using the chat program as I want them to have a separate multicast session. The if statements work and the client sends the message. The server just doesn't seem to relay it back to the client in either case.
The code for the client part is below:
if (userName.startsWith ("Steve") || userName.startsWith ("David"))
{
MulticastSocket socket = new MulticastSocket (4447);
InetAddress address = InetAddress.getByName ("233.0.0.13");
socket.joinGroup (address);
}
else
{
MulticastSocket socket = new MulticastSocket (4449);
InetAddress address = InetAddress.getByName ("232.0.0.13");
socket.joinGroup (address);
}
And the server part:
if (received.startsWith ("Steve") || received.startsWith ("David"))
{
InetAddress group = InetAddress.getByName ("233.0.0.13");
packet = new DatagramPacket (buf, buf.length, group, 4447);
socket.send (packet);
}
else
{
InetAddress group = InetAddress.getByName ("232.0.0.13");
packet = new DatagramPacket (buf, buf.length, group, 4449);
socket.send (packet);
}
Does anyone have any ideas??