Results 1 to 2 of 2
  1. #1
    mr_anderson is offline Member
    Join Date
    May 2010
    Location
    Florida
    Posts
    68
    Rep Power
    0

    Default binding a java program to a specific networkcard

    Hi
    how can I bind a java application to a specific LAN (in case you have more than one network card on your computer), my problem is that I have two LANs on my computer each connected to a different network and I am developing a java application which should communicate with one of the networks, the problem is that when the two LANS are ON the java application gets confused some times and simply donot connect, but when i turn the unwanted LAN (i.e. keeps only one LAN working) every thing works fine so I think if i bind the java application to the desired LAN I can work with both LANs ON, any ideas about binding a java program to use a specific LAN.
    (NOTE: one of the LANs is connected to a local network while the other is connected to the Internet).
    Regards.
    Anderson.

  2. #2
    Jononomous is offline Member
    Join Date
    Mar 2008
    Posts
    6
    Rep Power
    0

    Default

    Not so much to the card itself as to the IP Address that it's subject to. Using java's socket api you could do something such as...

    Java Code:
    InetSocketAddress addy = new InetSocketAddress("xx.xxx.xxx.xx", 9000);
    ServerSocket s = new ServerSocket();
    s.bind(addy);
    And this would bind it to whatever card is using "xx.xxx.xxx.xx"
    DHCP Reservation is your friend!

    Regards,

    - Jon

Similar Threads

  1. Replies: 0
    Last Post: 05-04-2010, 10:10 PM
  2. How to assigne Java thread to a specific cpu core
    By perl0101 in forum Advanced Java
    Replies: 3
    Last Post: 02-03-2010, 09:39 AM
  3. Link to specific part of a Java Servlet
    By jwilley44 in forum Java Servlet
    Replies: 2
    Last Post: 02-03-2009, 01:51 AM
  4. Replies: 2
    Last Post: 11-08-2008, 10:40 AM
  5. Custom XML to Java Type Binding using JAXB
    By surajkumar in forum XML
    Replies: 0
    Last Post: 09-02-2008, 12:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •