Results 1 to 6 of 6

Thread: Connecting and disconnecting from an internet connection

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Connecting and disconnecting from an internet connection

    My client want me to connect and disconnect from an internet connection automatically.

    How can I do that? can we do that from batch files? Is there an API to do so>?

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Connecting and disconnecting from an internet connection

    what type of connection?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: Connecting and disconnecting from an internet connection

    modem, dsl.

    However, I think I have figured out. It's just easier to use rasdial.

    Rasdial /disconnect
    rasdial "Connection Name"

    Works perfectly

    and then use shell to run the bat file.

    The client want to get a new IP from his ISP every 5 minutes or so.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: Connecting and disconnecting from an internet connection

    I wonder if there is also a shell command to make internet explorer use a certain IP settings.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: Connecting and disconnecting from an internet connection

    Quote Originally Posted by teguh123 View Post
    I wonder if there is also a shell command to make internet explorer use a certain IP settings.

    Okay, I do

    Shell "Rasdial """ + whatToPut("networkconnect") + """ /DISCONNECT"
    Shell "Rasdial """ + whatToPut("networkconnect") + """"

    The problem is if the 2 is too close together the first command hasn't finish disconnecting before the second command finish.

    I turn that into a bat file but how can we execute bat file in vb6, especially if it's network drive?

    I put waiting 2 seconds between the 2 command but I do not think it's an elegant solution. I want VB to automatically connect after disconnecting.

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Connecting and disconnecting from an internet connection

    i may be mistaken, but i would believe rasdial is only for dial up connections, nothing to do with any wan/adsl connection
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

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