ClosePort - method of the PmaComm object
Description:
Close the ethernet port or serial port of this object.
Syntax:
Boolean ClosePort()
Return value:
true - Port has been successfully closed.
false - The port was not closed. Possible cause: The port was not open before or is still being opened (for Ethernet-client the connection process may take more time and during this period the port cannot be closed)
Note:
for serial link: This method closes, for example the port
COM1 (
COM2 ..) and then this serial port can be used for communication with other object or other application.
In ordert continue the transfer through this object the
OpenPort method must be called.
See
Setting the parameters of the serial link.
for Ethernet-client: The
TCP connection is closed by this method.
It is useless to call this method for
UDP transfers.
After the connection is closed: in order to continue the transfers on the same TCP address and port it is
NOT necessary to call the
OpenPort method, because the connection is opened automatically before the new transmission starts.
See
Setting the parameters of the Ethernet-client.
This method can be called even in the
INFO system by clicking the "
Actions" button. See "
PmaRoot > Permissions > InfoEdit" permission.
Example:
JavaScriptVBScriptSelect and copy to clipboard
var oComm = pMe.Pm("/Comm");
oComm.ClosePort();
Dim oComm
Set oComm = pMe.Pm("/Comm")
oComm.ClosePort
History:
Pm8.02.13: This method now does not close the port while the port is being opened.