Free pascal ord3/12/2023 Procedure TForm1.bt_outputs_readClick(Sender:TObject) The user can request the status of the outputs and inputs by clicking on the corresponding button. LTCPComponent1.SendMessage(’GET/outputaccess1?PW=’ + ed_password.Text + ’&State=OFF&’,nil) LTCPComponent1.SendMessage(’GET/outputaccess1?PW=’ + ed_password.Text + ’&State=ON&’,nil) Procedure TForm1.cb_output1MouseUp(Sender:TOBject Button: TMouseButton Shift: TShiftState X, Y: Integer) LTCPComponent1.SendMessage(’GET/outputaccess0?PW=’ + ed_password.Text + ’&State=OFF&’,nil) LTCPComponent1.SendMessage(’GET/outputaccess0?PW=’ + ed_password.Text+ ’&State=ON&’,nil) Procedure TForm1.cb_output0MouseUp(Sender:TOBject Button: TMouseButton Shift: TShiftState X, Y: Integer) releasing the output check box, is used, the program carries out the corresponding procedure and - depending on whether the check box is set or not - passes the appropriate command to the Web-IO. The program uses the MouseUP event of this object. The user sets the outputs by using the two check boxes cb_output x. Operation and communication from the client sideĪs soon as a connection is made with the Web-IO, the user can use the corresponding program elements to send commands to the Web-IO Setting the outputs Procedure TForm1.LTCPComponent1Error(const msg: string aSocket: TLSocket) ģ. The status line also indicates the Winsock error number and the ErrorCode is then set to 0 so that no runtime error occurs. Procedure TForm1.LTCPComponent1Disconnect(aSocket:TLSocket) Īlso in case of a connection error the ClientSocket control element carries out a corresponding procedure which is essentially like the Disconnect procedure. Here again the ClientSocket control element invokes a corresponding procedure Procedure TForm1.bt_disconnectClick(Sender:TObject) The connection remains open until it is ended by the user clicking on the Disconnect button, or the Web-IO ends the connection. StatusBar1.SimpleText :=’Connected to ’ + ed_ip.Text Procedure TForm1.LTCPComponent1Connect(aSocket:TLSocket) The status line indicates that the connection has been established, the control elements are enabled for use and the Disconnect button is active again. LTCPComponent1.Connect(ed_ip.Text, strtoint(ed_port.Text)) Īs soon as the Web-IO accepts the connection, the ClientSocket control element carries out the corresponding procedure. Procedure TForm1.bt_connectClick(Sender: TObject) The connection is opened by entering the IP address of the Web-IO in the text field ed_ip and clicking on the bt_connect button. Connection control Establishing the connection In this example the first part of the name describes the type of object and the second part the function. ![]() When naming the individual objects it is helpful to use logical names.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |