CONNECT.PORT() |
![]() ![]() ![]() |
The CONNECT.PORT() function converts a phantom process into an interactive session, using a serial port as its terminal device.
This function is only available on Windows.
Format
CONNECT.PORT(port, baud, parity, bits, stop)
where
The CONNECT.PORT() function enables an application to start a phantom process that then uses a serial port as though it were a terminal device. The function returns true (1) if successful, false (0) if it fails. The STATUS() function can be used to determine the cause of failure.
Once the connection has been created, the process changes from a phantom to an interactive session and can use the normal QMBasic terminal i/o statements such as INPUT and PRINT to access the port. If the program exits to the command processor, the connection can be used in exactly the same way as if the user had logged in over the serial port. To terminate the session from within a program, execute the QUIT command.
Because this function converts the phantom process into an interactive user, the process consumes a licence. The CONNECT.PORT() function will fail if the user limit has been reached.
Example
IF NOT(CONNECT.PORT('COM1', 9600, 0, 8, 1)) THEN STOP 'Cannot open COMO1 port' END
This program fragment, used in a phantom process, connects to the device on the COM1 port as the command source, converting the process into an interactive session. |