Results 1 to 8 of 8

Thread: VB (but applies to all) - BEST way to disconnect internet connection

  1. #1

    Thread Starter
    Addicted Member Flip's Avatar
    Join Date
    Jun 2002
    Location
    Burke, VA
    Posts
    247

    VB (but applies to all) - BEST way to disconnect internet connection

    After searching for hours to find the perfect way to solve this problem, I thought to myself "Why not just do it through the command prompt? Everything works better in there". So here it is:

    VB Code:
    1. RunCommand "RasDial /DISCONNECT"

    I have attached the module including the code used to run Command Prompt commands in VB.

    Reason why I think this is the best:
    I have seen the other APIs like AutoDialHangup and all of that, but I think this way is the best because you don't have to create the connection with any extra code in order to close it. This works every time, with any kind of dialup connection.

    Anyone think there is a better, easier way?
    Attached Files Attached Files
    The "company" website My homepage: nerisoft.com
    scars heal but glory is forever

  2. #2
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    Prague, Czech Republic
    Posts
    350
    2 things Flip,

    1] What if there isn't RAS installed?
    2] What if there is internet connection using LAN?

    Well I know it wouldn't work in these case, but how disconnect these?

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    for a brutal approacch, you could try

    ipconfig /release

    this will disconnect most everything

  4. #4
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    Prague, Czech Republic
    Posts
    350

    /release Release the IP address for the specified adapter.


    I thought this only releases IP address and if I am on DHCP I will get new one, isn't ?

    More over, I am connected using dial-up modem and I've tried it, with this result:


    The operation failed as no adapter is in the state permissible for
    this operation.


  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    no new ip's until you do IPCONFIG \RENEW
    not sure of the effect on STATIC ip's though

    maybe you need a combination of the three?


  6. #6

    Thread Starter
    Addicted Member Flip's Avatar
    Join Date
    Jun 2002
    Location
    Burke, VA
    Posts
    247

    usage

    I used this do disconnect a shared internet connection (LAN) where the host had a dialup connection, and both computers ran WindowsXP.

    As far as I know, RASDIAL is built in to Windows XP (and probabaly earlier versions) - so this should work on any computer.


    ***I THINK***
    "ipconfig /release" won't hangup a dialup internet connection. It just resets some kind of setting that I don't know anything about, and a restart is required for this to take effect anyway.
    ************


    So, Jhd.Honza:
    "RasDial /DISCONNECT" should be the command that hangs up your connection, otherwise I have no idea why this isn't working for you
    The "company" website My homepage: nerisoft.com
    scars heal but glory is forever

  7. #7
    Member
    Join Date
    Sep 2008
    Location
    Turkey
    Posts
    37

    Re: VB (but applies to all) - BEST way to disconnect internet connection

    Thanks For Sharing...

  8. #8
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: VB (but applies to all) - BEST way to disconnect internet connection

    It works on my connection. But it doesn't work on my client's connection.

    He uses asdl and to disconnect he needs username and password. He uses adsl or something.

    CLAD genius software can do that though.

Posting Permissions

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



Click Here to Expand Forum to Full Width