How can I check internet conection?

Discussion in 'Java' started by Flamadin, Jul 2, 2004.

  1. Flamadin

    Flamadin Guest

    Hello, I need to check internet conection. Actualy I use:

    InetAddress[] all =
    InetAddress.getAllByName(InetAddress.getLocalHost().getHostName());

    Whith this code, when a computer is conected to a lan but isn't conected to
    internet, I only get the private address, and when it uses a dial-up
    conection and I try to check internet conection again (the program is still
    running) this function returns the same (only private address). How can I
    refresh IP address?

    Thanks

    Patrick
     
    Flamadin, Jul 2, 2004
    #1
    1. Advertising

  2. Flamadin

    Sam Guest

    "Flamadin" <> wrote in message news:<Fn9Fc.1300902$>...
    > Hello, I need to check internet conection. Actualy I use:
    >
    > InetAddress[] all =
    > InetAddress.getAllByName(InetAddress.getLocalHost().getHostName());
    >
    > Whith this code, when a computer is conected to a lan but isn't conected to
    > internet, I only get the private address, and when it uses a dial-up
    > conection and I try to check internet conection again (the program is still
    > running) this function returns the same (only private address). How can I
    > refresh IP address?
    >
    > Thanks
    >
    > Patrick


    Patrick,

    I think what's happening is that you're still connected to the lan, by
    means of a nic card, which is associated with an ip address (type
    ipconfig to see this). This address doesn't change despite the fact
    that you are now connecting to the internet via a modem.

    I'm pretty sure an ISP uses NAT to translate between thier public
    (static) ip and the one that's being used for communication with your
    system in the case of modem. It probably dynamically assigns an ip
    address each time you dial in. Otoh, the IP address assigned to your
    home varies every few days or something when you have a permanent
    connection with your isp (such as cable). Note that if you have a lan
    in your home, your lan address doesn't change - I'm guessing that your
    lan router does a similar conversion between your dynamically assigned
    ip address and your lan's static addresses.

    Which still doesn't answer the question of what is the dynamic ip
    address assigned to your modem? That I don't know. One thing you could
    do is install a packet monitor, and then just look at the ip address -
    but I don't know monitors works on modems.

    Regards,
    Mark
     
    Sam, Jul 2, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rered

    Conection from dreamwaver

    rered, Mar 2, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    367
    Grant Merwitz
    Mar 2, 2005
  2. arthernan
    Replies:
    0
    Views:
    1,507
    arthernan
    Mar 10, 2006
  3. Anuradha

    Db2 Conection

    Anuradha, Jun 1, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    395
    Mark Rae
    Jun 1, 2006
  4. =?Utf-8?B?RG91ZyBTYWxvbW9u?=

    objectdatasource sqldatareader and conection pooling

    =?Utf-8?B?RG91ZyBTYWxvbW9u?=, Nov 10, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    820
    heinz
    Nov 14, 2006
  5. majek
    Replies:
    0
    Views:
    986
    majek
    May 25, 2009
Loading...

Share This Page