Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blocking of participants for multicast chat

Status
Not open for further replies.

SnowyMeowy

Technical User
Mar 19, 2001
11
US
Hello experts,

Currently, i am doing a project using JMF on multicast chatting. I am in charge of the module whereby the chat will be able to block a participant from entering the chat by keeping track of its IP address. The protocol that will be used is UDP. However, I had no idea as to how I should start this project. I wonder if anyone of you had any codes or examples that I could reference to? Thanks
 
Hi,

Are you saying that you will not allow any pc to make 2 connections to the server program at the same time?? If so, then sorry to say but I don't think there are any known methods that is possible to do so.

In Multicast UDP, all the clients connecting to the server from different pcs' listen to the same port number and InetAddress to receive the incoming DatagramPackets. You might think that maybe you can get the Ip from the incoming address and from there, request for the later client to close the program. But it isn't possible because there is no way to differentiate between the 2 clients in the same pc since both of them uses the same Ip (the Ip of the client machine) and both listens to the same Ip and Port (from the server).

However there is a solution to this problem (which I guess might be the only solution but I don't think is very gd to use).

- Have a boolean in the client program.
- Set it to like 'false' before connection.
- Connect to the server program.
- In the server program, keep track of all of the incoming InetAddress (Ip), which you can get from the DatagramPackets, in a Vector or ArrayList.
- Check whether the incoming Ip is in the Vector or not.
- If yes return a packet back to the client(not to the entire group) like 'true'

Since the first client does not have the Ip in the Vector, it would receive a 'false'. So upon receiving the 'false' from the server, it would change the local variable you declared earlier before you make the connection to the Server program to 'true'.

When the second client connects to the same Server, a 'true' would be return instead. Since the packet would be sent back to the client machine that is running 2 instance of the client program, check whether the local variable is true or false.

The first client program will have the variable as true so nothing will be done. The second client program will have the variable as false and will therefore exit immediately.

Hope it is clear and helps you
Leon. If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top