[Coco] My FTP Client

Bill Nobel b_nobel at hotmail.com
Tue Jun 24 23:21:42 EDT 2014


I sent this to Aaron,but I thought I might try here too…

Hi Aaron, I hope you can tell me what I am doing wrong in my code. Here is my FTP Open from my client I am writing.  I use net.as and alib  as of the 3.3.0 release.  The drivewire server window shows:
DWVPortHandler dwproto-0-12 Unknown API command: ‘OK CONNECTED to 10.0.1.30:21’
DWVPortHandler dwproto-0-12 Unknown API command: ‘FAIL 010 UNKNOWN API ‘OK’'
DWVPortHandler dwproto-0-12 Unknown API command: ‘FAIL 010 UNKNOWN API ‘FAIL’'
DWVPortHandler dwproto-0-12 Unknown API command: ‘FAIL 010 UNKNOWN API ‘FAIL''

The FTP server is currently my Raspi Pi at IP:10.0.1.30.  The client locks up at the I$ReadLn in TCPConnectToHost until I hit ctrl-c then client returns to the Host connect error. I get no data from TCPConnectToHost.
It’s probably something I am not understanding correctly, but I studied the Telnet.as from the Nitros9 repo.

Bill Nobel

* FTP Open
*
* Entry: X = command line
*
ftpOpn:     pshs    x           save pointer of command line
* Open a path to DW
          lda     <gDWPath    already have path to DW?
          bne     gotdwpth    yes, jump to host connection
          lbsr    TCPOpen     get next path to DW
          lbcs    dwpther
          sta     <gDWPath
* get host from buffer
gotdwpth    leax    5,x         skip past 'open '
          stx     gFtpHost,u    save pointer to hostname start
opnhst1     lda     ,x+         get char of hostname
          cmpa    #C$SPAC
          beq     nilit
          cmpa    #C$CR
          beq     nilit
          bra     opnhst1
nilit       clr     -1,x
          cmpa    #C$CR
          beq     defport
skipspc     lda     ,x+
          cmpa    #C$CR
          beq     defport
          cmpa    #C$SPAC
          beq     skipspc
          leay    -1,x
          bra     prtprsedn

dprtstr     fcc     /21/
          fcb     $00
defport     leay    dprtstr,pc
prtprsedn   ldx     gFtpHost,u
          sty     gFtpPort,u
* move host & port out of command buffer
          leay    gFtpHstS,u
          lbsr    STRCPY
          sty     gFtpHost,u          save new pointer to host
          ldx     gFtpPort,u
          leay    gFtpPrtS,u
          lbsr    STRCPY
          sty     gFtpPort,u          save new pointer to port
          lda     #1
          leax    tryopn,pc
          lbsr    FPUTS
          ldx     gFtpHost,u
          lda     #1
          lbsr    FPUTS
          leax    spc,pc
          lbsr    FPUTS
          ldx     gFtpPort,u
          lbsr    FPUTS
          leax    cr,pc
          lbsr    FPUTS

          ldx     gFtpHost,u          X=’10.0.1.30’ null
          ldy     gFtpPort,u           Y=’21’ null
          lda     gDWPath,u
          lbsr    TCPConnectToHost    stops here
          bcs     cnerr
          lbsr    RawPath
          lda     #1
          sta     gConnected,u
          leax    stcnect,pc
          lbsr    FPUTS
          lbra    MainLop

cr          fdb     $0d00
spc         fdb     $2000

strcnerr    fcc     /Host connect error/
          fdb     $0d00
cnerr       leax    strcnerr,pc
          lda     #1
          lbsr    FPUTS
          lda     gDWPath,u
          lbsr    TCPDisconnect
          clr     gConnected,u
          lbra    MainLop

stcnect     fcc     /Connected.../
          fdb     $0d00

tryopn      fcc     /Connecting to /
          fcb     $00

* Can't connect to DriveWire
dwptxt      fcc     /?DriveWire Path error./
          fdb     $0d00
dwpther     leax    dwptxt,pc
          lda     #1
          lbsr    FPUTS
          lbra    MainLop


More information about the Coco mailing list