TraceFile Property  
 

Specify the socket function trace output file.

Syntax

object.TraceFile [= filename ]

Remarks

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 105020 0000 INF: WSAAsyncSelect(46, 0xcc4, 0x7e9, 0x27) returned 0
VB6 105020 0015 WRN: connect(46, 192.0.0.1:1234, 16) returned -1 [10035]
VB6 111535 0000 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 is the local time in hours, minutes and seconds. The third column is the elapsed time in milliseconds since the previous function call. The fourth 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:

aa.bb.cc.dd:nnnn

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 192.0.0.1 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

String

See Also

Trace Property, TraceFlags Property