Simple Async Dial-Up Connection With Error Recovery |
Top Previous Next |
This example builds on the previous one and adds some error recovery and reporting. As before, once connected, it sends a file named 'login'. If the send file completes normally, a second file is sent. If it is also sent successfully, the script file waits for a single file from the remote system. Once a file is received, or if the receive command times out, the script file disconnects and exits.
DIAL "1-512-555-1212" ;; check for connection IFERROR= $ERROR_CONNECT_TIMEOUT goto connect_timeout ;; check for line busy IFERROR= $ERROR_BUSY_SIGNAL goto line_busy ;; just exit if any other error IFERROR goto exit ;; send two files in a row SENDFILE "login" /timeout=30 ;; check for send time-out IFERROR= $ERROR_OPTIMEDOUT goto xmt_timeout SENDFILE "accounts" ;; wait for host reply RCVFILE "newdata" /timeout=60 :exit :connect_timeout MESSAGEBOX "**ATTENTION: Cannot connect, dial time-out" EXIT :line_busy MESSAGEBOX "**ATTENTION: Line is busy" EXIT :xmt_timeout MESSAGEBOX "**ATTENTION: Remote unable to receive" DISCONNECT EXIT |