[Beds] Java Multicast Problem

Stephen Elliott techweb at ntlworld.com
Thu Feb 1 19:24:38 GMT 2007


Hi,


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"))
		        {
	              System.out.println ("metn 1st point");
			  InetAddress group = InetAddress.getByName ("233.0.0.13");
          		  packet = new DatagramPacket (buf, buf.length, group, 4447);
                    socket.send (packet);
                    System.out.println ("met 2nd point");
		        }
		        else
		        {
                    InetAddress group = InetAddress.getByName
("232.0.0.13");
                    packet = new DatagramPacket (buf, buf.length, group,
4449);
                    socket.send (packet);
                    }

I have verified this is not a firewall issue as I have tried running it at
home. I have also attached full copies of my code to this e-mail in case you
need to refer to them. Have you got any ideas?

Many Thanks
Stephen Elliott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MulticastChatClient.java
Type: application/octet-stream
Size: 4895 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/beds/attachments/20070201/e3674205/MulticastChatClient.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MulticastChatServer.java
Type: application/octet-stream
Size: 2384 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/beds/attachments/20070201/e3674205/MulticastChatServer.obj


More information about the Beds mailing list