Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Quick wininet api question (VB6 SP5)

    When using the wininet API, if a connection is made twice without closing it in between, will there be 2 connections or will it just re-establish a single connection?

    The line that calls the API is as follows (from MDSN):
    hConnection = InternetConnect(hOpen, txtServer.Text, INTERNET_INVALID_PORT_NUMBER, _
    txtUser, txtPassword, INTERNET_SERVICE_FTP, nFlag, 0)

    Any help would be much appreciated.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Quick wininet api question (VB6 SP5)

    I've never tried this, but I would expect a new connection every time you call that method. Otherwise, how would you create a new connection? Perhaps you can test this theory: If you debug.print the hConnection value, does it change after the second call?

  3. #3
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Quick wininet api question (VB6 SP5)

    It does change, but does that necessarily mean the previous connection will be closed?

    When I have programmed myself a put or get module (or anything that actually uses the connection) I will make a connection and store the connection handle elsewhere, then make a new connection and see if the original one still works using a put or get command.

    While im on the subject of those commands. While writing my get command I noticed the file I specified disappeared from its original location. Does the "put" command move files instead of copy? I haven't tested my theory yet but it appears that the get command moved my file, and where I boke and stopped the code, didn't get to the writing stage, therefore my file disappeared completely!!!

    ADDITONAL: Just spoken to our ftp administrator and it seems there may be a program running to delete foreign files on the server, therefore that would explain why my files disappear, so unless I can get him to switch it off, testing is limited to small windows of opportunity - joy!

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Quick wininet api question (VB6 SP5)

    > does that necessarily mean the previous connection will be closed?

    No, you might have any number of connection open. And that could be a bad thing...

  5. #5
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Quick wininet api question (VB6 SP5)

    In other words, if im writing an FTP program, ill need to keep a log (in a variable or something) of any connections that are made and make sure they are closed if the program crashes or ends.

    I don't suppose there is a way of detecting any open connections?

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Quick wininet api question (VB6 SP5)

    I hope someone else can contribute, as I have no experience with this API.

Posting Permissions

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