.PROGRAM tcpclient()

        AUTO client_mode, lun, status, do_wait
        AUTO $message, $echo, $read_str
; Initialize constants.
        client_mode = 0
        do_wait = 0
; Attach to the TCP device
        ATTACH (lun, 4) "TCP"
        TYPE "lun: ", lun
        status = IOSTAT(lun) ;Check status of ATTACH
        IF status < 0 THEN
            TYPE "Error from ATTACH: ", $ERROR(status)
            GOTO 100
        END
        FSET (lun) "/node 'cell2' /address 127.0.0.1"
; "cell2" is the name of the serveroncection as defined either in the default controller configuration or using a FSET instruction. A local port number is auto
        FOPEN (lun, 0) "cell2 /REMOTE_PORT 2500 /BUFFER_SIZE 1024"
        status = IOSTAT(lun) ;Check status of FOPEN
        IF status < 0 THEN
            TYPE "Error from FOPEN: ", $ERROR(status)
            GOTO 100
        END
        repeat_loop = TRUE
        WHILE repeat_loop DO
            READ (lun, do_wait) $read_str
            WRITE (lun) $read_str
            m = 0                                        ;Set array index
            DO
                $temp = $DECODE($read_str," ,",0) ;用逗号隔开的字符串,分割
        ;Pick off a number string
                suiyue[m] = VAL($temp)
                $temp = $DECODE($read_str," ,",1)
        ;Discard spaces and commas
                m = m+1
        ;Advance the array index 最后面是空格作为结束符号
            UNTIL $read_str == ""
        ;Stop when input is empty
            ;SET loc3 = TRANS(suiyue[0],suiyue[1],suiyue[2],suiyue[3],suiyue[4],suiyue[5])
            ;MOVE loc3
            EXECUTE 2 move01()
        ;    IF $inp_str == "quit" THEN
         ;   repeat_loop = FALSE
       ; END
        END
   100
        FCLOSE (lun)
        DETACH (lun)
        RETURN
.END