Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2007

Tip: Looking for answers? Try searching our database.

Multicast problem :(

Thread view: 
tricky - 20 Oct 2007 15:56 GMT
Hi all,

   I have a question. I need to create multicast socket but on more then
one interface. I try to do this but unfortunetly it is setup only on one
interface ?
Do a need different ip (group ) per each interface or maybe port or maybe
it's impossible ?

port and ip is the same per each interface
During iterations setInterface() is invoked

public void setInterface(NetworkInterface i){
       try {
           logger.info("MulticastAnnouncer");

           this.address = InetAddress.getByName(defaultIP);
           this.socket = new MulticastSocket(port);
           this.socket.setNetworkInterface(i);
           this.socket.joinGroup(this.address);
Esmond Pitt - 21 Oct 2007 10:50 GMT
> Do a need different ip (group ) per each interface

Yes
tricky - 21 Oct 2007 12:28 GMT
>> Do a need different ip (group ) per each interface
>
> Yes

Unfortunetly it doesn't work :( only default interface is used

private static final String defaultIP = "239.0.2.10"; <-this is changed
depended on interface number

  public void setInterface(NetworkInterface i){
       try {
           logger.info("MulticastAnnounce setting interface");

           this.address = InetAddress.getByName(defaultIP);
           this.socket = new MulticastSocket(port);
           this.socket.setNetworkInterface(i);
           this.socket.joinGroup(this.address);

           logger.info("MulticastSocket Annoucer success");

           this.socket = socket;

       }catch(Exception e){
           logger.error("Cannot set network Interface:"+e.toString());

       }
Esmond Pitt - 22 Oct 2007 05:32 GMT
setInterface() is really only useful for outbound traffic. You need to
use the version of join() where you specify the NetworkInterface, in a
loop, so that you join the group via all available NICs.
tricky - 22 Oct 2007 17:43 GMT
It works under windows but not under linux :(

> setInterface() is really only useful for outbound traffic. You need to use
> the version of join() where you specify the NetworkInterface, in a loop,
> so that you join the group via all available NICs.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.