NOTICE: Immediately re-connect the server after disconnection

When a user immediately connects to the server after disconnection, a problem will occurs. Refer to below code.

; Sending the exit command to disconnect the remote host.
sendln "exit"

; Re-connect the remote host.
connect "server"

This macro script will do not work in most cases.
When a user sends the exit command, it will take a few minutes to disconnect the server. So, a time lag will occur.
If a user uses the connect command while the time lag occurs, the connect command will become successful because the local host still connects to the remote host.

To fix this problem, use the connect command after finish the disconnection. See below code.

; Sends the exit command and prompts the server disconnection.
sendln "exit"

do
	; Waits 10 msec.
	mpause 10
	; Confirms the connection status.
	testlink
; Repeats if TeraTerm connects the server. See result is 2.
loop while result = 2

; Re-connects a new connection.
connect "server"

Also, when Auto window close configuration is enabled, a user uses the unlink command. Refer to in the following code:

; Sends the exit command and prompts the server disconnection.
sendln "exit"

; Unlinks TeraTerm.
unlink

; Re-connects a new connection.
connect "server"