Microsoft KB Archive/219956

= You receive the "Too many files open" error message when you run VFP on Windows Terminal Server =

Article ID: 219956

Article Last Modified on 2/2/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft FoxPro 2.6 Standard Edition
 * Microsoft FoxPro 2.6a Standard Edition
 * Microsoft Windows NT 4.0

-



This article was previously published under Q219956



SYMPTOMS
When you run Microsoft Visual FoxPro applications through Microsoft Windows Terminal Server, and if more than 2048 handles are open, you receive the following error message:

Too many files open



CAUSE
To maintain compatibility with existing Server Message Block (SMB)-based products (for example, Windows NT 3.x and 4.0, Windows 95), Terminal Server's use of SMB has not been modified from Windows NT Server 4.0. This may cause a problem if several Terminal Server users connect to a single network share, either on the Terminal Server or elsewhere on the network. The potential problem is an SMB limitation of 2048 open file handles.



MORE INFORMATION
The error message indicates that FoxPro for Windows or Visual FoxPro has attempted to open more than it's internal limit of files. This behavior and the resulting error message occur as a result of a limitation of 2048 open file handles in Windows NT Terminal Server.

Note Microsoft does not support FoxPro for Windows or Visual FoxPro for Windows running on Windows NT 4.0 Terminal Services.

With Windows 2000 server, the open file handles limit has been expanded to 16,384 (as seen with "Net Config server"). While the open file handles limit has been expanded, the error may still occur unless use of a separate virtual circuit by each Terminal Server has been enabled.

Steps to reproduce the behavior
 Initiate a connection to a Windows NT Terminal Server. Using the connection to Windows NT Terminal Server, launch a session of FoxPro for Windows or Visual FoxPro.  Create a program file called "MAXFILES.PRG", using the following code: FOR i=1 TO 684 SELECT 0 make_cmd="create table test"+ALLTRIM(STR(i))+" (var1 c(10), var2 m)" *!* Open one file handle for each table created *!* Open a second file handle for each fpt file &make_cmd select_table="test"+ALLTRIM(STR(i)) SELECT (select_table) index_cmd="index on var1 tag junk of test"+ALLTRIM(STR(i)) *!* Open a third file handle for each index created &index_cmd NEXT  From the Command window, type "DO MAXFILES." Observe that the program will error out with the following error message:

Too many files open

 Click Suspend</li>  From the Command window, type the following code: ? i ? i*3 Note that the value for i that is displayed is 683, and the value that is displayed for i*3 is 2049. </li></ol>

<div class="references_section">