TraceFile Property  

Specify the socket function trace output file.


object.TraceFile [= filename ]


The TraceFile property is used to specify the name of the trace file that is created when socket function tracing is enabled. If this property is set to an empty string (the default value), then a file named CSTRACE.LOG is created in the system's temporary directory. If no temporary directory exists, then the file is created in the current working directory.

If the file exists, the trace output is appended to the file, otherwise the file is created. Since socket function tracing is enabled per-process, the trace file is shared by all instances of the controls being used. If multiple controls have tracing enabled, the TraceFile property should be set to the same value for each control. Since trace files can grow very quickly, even with modest applications, it is recommended that you delete the file when it is no longer needed.

The trace file has the following format:

VB6 INF: WSAAsyncSelect(46, 0xcc4, 0x7e9, 0x27) returned 0
VB6 WRN: connect(46,, 16) returned -1 [10035]
VB6 ERR: accept(46, NULL, 0x0) returned -1 [10038]

The first column contains the name of the process that is being traced (in this case, it is Visual Basic 6.0). The second column identifies if the trace record is reporting information, a warning, or an error. What follows is the name of the function being called, the arguments passed to the function and the function's return value. If a warning or error is reported, the error code is appended to the record (the value is placed inside brackets).

If parameters are passed as integer values, they are recorded in decimal. If the parameter or return value is a pointer (a memory address), it is recorded as a hexadecimal value preceded with "0x". A special type of pointer, called a null pointer, is recorded as NULL. Those functions which expect socket addresses are displayed in the following format:

The first four numbers separated by periods represent the IP address, and the number following the colon represents the port number in host byte order. Note that in the second line of the above example, the control is attempting to connect to a system with the IP address on port 1234.

Note that if the specified file cannot be created, or the user does not have permission to modify an existing file, the error is silently ignored and no trace output will be generated.

Data Type


See Also

Trace Property, TraceFlags Property