Is it possible to specify which network interface for a JVM ( or IDE ) to use
java, networking
Solution
Yes, you can specify by following way:
int port= 52000; //some free port
MulticastSocket msocket = new MulticastSocket(port);
msocket.setInterface(InetAddress.getByName("172.16.30.205"));
Where `172.16.30.205` is one of my PC's IP address and I would like to communicate through interface.
Problem
The situation goes like this, I have two network interfaces in my macbook pro. One is a statically defined Ethernet interface and the other one is a DHCP configured wireless interface. I am trying to figure out how to configure a specific java project to use my statically wired interface only and not simply pick the first one in the list either through the JVM or through my IDEA ( IntelliJ 8 ) I have managed to achieve this via an instance of vmware where I have my virtual environment feeding off my wired interface only but this ads performance problems and just general headaches of flipping between windows / osx. I have so far been unable to find a jvm property that let's me specify which nic gets used nor have I seen documentation for IntelliJ that defines that. If anyone has any ideas on how to solve this as painlessly as possible I would appreciate the help.