Announcement

Collapse
No announcement yet.

how many files?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how many files?

    Hello all...

    I was just wondering how many files can PBDLL6 open, maybe a better way to ask this would be... What is the range of numbers returned by FREEFILE. ie... 0-100, 0-1000?

    Cheers!

  • #2
    Mark,

    please find this in PB-Help, OPEN-Statement:

    filenum can be any integer value. In Windows 95/98, use the
    FILES statement in your CONFIG.SYS file to increase or decrease
    the maximum number of files that can be open at one time.
    In Windows NT, use the FILES statement in your CONFIG.NT file.
    See your operating system reference manual for more information.

    I just tried to open 32000 files ....

    Cheers, Hanns.


    ------------------

    Comment


    • #3
      Does this old DOS limitation still exist? I thought than windows(NT/9X) would have handled this diffrently by now. Is it safe to assume that FREEFILE will "never" return a number higher than 65535?

      ------------------
      Cheers

      Comment


      • #4
        Have you tried to test it yourself? I wrote a small PB/CC app to test the theory... I ran this on Windows 2000 (NT5) with 8 other processes running. I'll post the results once the code finishes... it's got more than 2400 files open so far, and still it is running fine and opening more files!

        BTW, my CONFIG.NT has FILES=40.

        Here is the code I've got running right now:
        Code:
        FUNCTION PBMAIN
            ON ERROR GOTO errhandler
        
            DO
                y& = FREEFILE
                IF y& THEN
                    OPEN "D:\TEMP\X" + FORMAT$(y&) FOR OUTPUT AS #y&
                    PRINT ERR, ERRAPI, y&,
                    PRINT #y&, "a";
                    PRINT ERR, ERRAPI
                END IF
            LOOP UNTIL y& = 0
            PRINT "Done!"
        
        Res:
        
            CLOSE
            PRINT "close err = " ERR, ERRAPI
            WAITKEY$
            EXIT FUNCTION
        
        errhandler:
        
            PRINT "ERROR!!! = " ERR, ERRAPI
            RESUME res
        END FUNCTION
        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          I got to over 9000 files before my system slowed enough to interfere with my normal work, so I stopped the test at that point - it was still happily opening new files without any errors.

          It did make for some interesting statistics in Task Manager though!

          How many files did you want to open, anyway?

          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6
            Hey Lance!

            I haven't tried your example code yet but will soon. The reason I wanted to know what range of file numbers FREEFILE returned was to see if it was feasible to allocate an array of that size. This would have let me manage my incomming sockets and there file handles better. My project is a bit nasty, I have to be able to send well data accross a 2400baud cell phone box, over the internet. At any one time there may be as many as 30 geologists trying to upload data. The connection is bad enough without having to deal with all those sockets in a clean way. This is also why I have been very concerned about packet fragmentation and loss. At this point I have no way of knowing if the packet has been fragmented because I can NOT do multiple TCP RECV calls inside a loop. This behavior I have already dicussed with you and I have sent you samples...

            I just cant figure out why this code locks up on my computer...

            Code:
            do
              tcp recv hsock, 2048, buffer <- hangs here until disconnect.
              message = (message & buffer)
            loop while len(buffer)

            Oh well, I'm sure R&D is looking into this!



            ------------------
            Cheers

            Comment


            • #7
              Hello again...

              Lance, can I change the password for my profile to something that I can remember easily? the password I have know is very cryptic to say the least... (smile)



              ------------------
              Cheers

              Comment


              • #8
                Mark, you have to change your own password. Click on the "Profile" link in the top-right-hand corner of most BBS pages.

                ------------------
                Lance
                PowerBASIC Support
                mailto:[email protected][email protected]</A>
                Lance
                mailto:[email protected]

                Comment


                • #9
                  Originally posted by mark smit:
                  Does this old DOS limitation still exist? I thought than windows(NT/9X) would have handled this diffrently by now. Is it safe to assume that FREEFILE will "never" return a number higher than 65535?
                  Writing code that relies on dependencies like this is really not a good programming practice, as it may cause your code may suddenly stop working with a future version of the compiler or operating system. I'd advise finding another approach.


                  ------------------
                  Tom Hanlin
                  PowerBASIC Staff

                  Comment

                  Working...
                  X