Web page loading time
- Last UpdatedFeb 14, 2023
- 2 minute read
For points with Location2 set to 11, the interface reports the time it takes to load a particular page on a Web server. TCPResponse invokes a third-party library function call to load a user specified Web page, for example, a web page located at DEVICE=192.168.8.76/cgi-bin/aTestProgram.exe in the InstrumentTag. The interface uses either the HTTPS protocol by default or the HTTP protocol if PORT=HTTP is specified in the InstrumentTag.
When the protocol is HTTPS, the default port number is 443. When the protocol is HTTP, the default port number is 80. The user may specify a particular port number by PORT= in the InstrumentTag.
The time measured by the interface is the amount of time that the third-party library function call takes to complete. If the third-party library function reports that it cannot connect to the specified machine, the interface writes I/O Timeout. For all other errors, the interface writes Bad Input.
Username/password authentication and expected reply
You have the option of specifying a username, password, and authentication type. The interface supports a user-based security model. You must specify the user name, password and authentication type. Authentication configuration should be placed in the password file, pitcpresp#.password, which must be located in the same directory as the interface executable.
Note: # in the password file name is the service ID of the interface.
The password file is case-sensitive.
User name, password and authentication type are configured as follows:
-
For the web page URL use the keyword device=web page URL. For example: device=www.theWebSite.com/thePage.html
-
For the user name use the keyword user=username. For example: user=theUser;
-
For the password, use the keyword password=mypassword. For example: password=thePassword;
The password file is best maintained by using PI ICU and the PITCTPResponse ICU Control; the format of this plain text file is as follows:
# pitcpresp<interface service ID>.password
# a '#' indicates a comment line
# specify a grouping of device, username, and password
device=www.theWebSite.com/thePage.html
user=theUser
password=thePassword
# for easier legibility, use '#' to separate a group of device,
# username, password
device=www.theWebSite.com/thePage.html
user=anotherUser
password=anotherPassword
#
device=www.company.com/cgi-bin/theApp.exe
user=user1
password=passwordForUser1
# end of pitcpresp<interface service ID>.password
A comment line cannot occur within the group of parameters:
-
device
-
user
-
password
The following is illegal:
# Invalid pitcpresp<interface service ID>.password file
device=www.theWebSite.com/thePage.html
user=theUser
# you cannot have a comment within a grouping
password=thePassword
Tip: You should also use the -ENC command line parameter, which will cause the interface to store authentication information in Windows Credential Manager and delete password files when the interface starts.
For authentication, use the keyword auth=authentication type in each PI point's InstrumentTag. For example: . The supported authentication types are BASIC and NTLM.
After loading the Web page, the interface checks whether the user-specified value in REPLY= is within the first 1024 characters of the page.
Note: This is a case-sensitive search.
Thus, if the Web page contains the text "Welcome" as part of the first 1024 characters, you need to specify "REPLY=Welcome" in the InstrumentTag. Otherwise, the Interface writes Bad Input.