fixes
This commit is contained in:
parent
ba3086036c
commit
4451fb0a93
|
@ -1156,7 +1156,30 @@ PUB lan_rxtime(handleidx, timeout): rxbyte
|
||||||
|
|
||||||
PUB lan_rxbyte
|
PUB lan_rxbyte
|
||||||
PUB lan_rxdatatime
|
PUB lan_rxdatatime
|
||||||
PUB lan_rxdata
|
PUB lan_rxdata(handleidx, filename, len): error | fnr
|
||||||
|
''funktionsgruppe : lan
|
||||||
|
''funktion : bei bestehender Verbindung die angegebene Datenmenge empfangen
|
||||||
|
''eingabe : -
|
||||||
|
''ausgabe : -
|
||||||
|
''busprotokoll : [086][put.handleidx][sub_putlong.len][get.byte1][get.byte<len>][get.error]
|
||||||
|
'' : handleidx - lfd. Nr. der Verbindung
|
||||||
|
'' : byte1 ... byte<len> - zu empfangende Bytes
|
||||||
|
'' : len - Anzahl zu empfangende Bytes
|
||||||
|
'' : error - ungleich Null bei Fehler
|
||||||
|
|
||||||
|
rd_newfile(filename,len)
|
||||||
|
fnr := rd_open(filename)
|
||||||
|
ifnot fnr == -1
|
||||||
|
bus_putchar1(gc#a_lanRXData)
|
||||||
|
bus_putchar1(handleidx)
|
||||||
|
bus_putlong1(len)
|
||||||
|
repeat len
|
||||||
|
rd_put(fnr,bus_getchar1)
|
||||||
|
rd_close(fnr)
|
||||||
|
|
||||||
|
error := bus_getchar1
|
||||||
|
error := ~error
|
||||||
|
|
||||||
PUB lan_txflush
|
PUB lan_txflush
|
||||||
PUB lan_txcheck(handleidx, txbyte): error
|
PUB lan_txcheck(handleidx, txbyte): error
|
||||||
''funktionsgruppe : lan
|
''funktionsgruppe : lan
|
||||||
|
|
|
@ -1202,7 +1202,7 @@ PRI lan_connect | ipaddr, remoteport, handle, handleidx, i
|
||||||
quit
|
quit
|
||||||
i++
|
i++
|
||||||
|
|
||||||
ifnot (handle := sock.connect(ipaddr, remoteport, @bufrx[i*sock#sNumSockets], rxlen, @buftx[i*sock#sNumSockets], txlen)) ==-102
|
ifnot (handle := sock.connect(ipaddr, remoteport, @bufrx[i*rxlen], rxlen, @buftx[i*txlen], txlen)) ==-102
|
||||||
handleidx := handle.byte[0] 'extract the handle index from the lower 8 bits
|
handleidx := handle.byte[0] 'extract the handle index from the lower 8 bits
|
||||||
sockhandle[handleidx] := handle 'komplettes handle zu handle index speichern
|
sockhandle[handleidx] := handle 'komplettes handle zu handle index speichern
|
||||||
bufidx[i] :=handleidx
|
bufidx[i] :=handleidx
|
||||||
|
@ -1320,7 +1320,30 @@ PRI lan_rxtime | handleidx, timeout, t, rxbyte
|
||||||
|
|
||||||
PRI lan_rxbyte
|
PRI lan_rxbyte
|
||||||
PRI lan_rxdatatime
|
PRI lan_rxdatatime
|
||||||
PRI lan_rxdata
|
PRI lan_rxdata | handleidx, len, rxbyte, error
|
||||||
|
''funktionsgruppe : lan
|
||||||
|
''funktion : bei bestehender Verbindung die angegebene Datenmenge empfangen
|
||||||
|
''eingabe : -
|
||||||
|
''ausgabe : -
|
||||||
|
''busprotokoll : [086][get.handleidx][sub_getlong.len][put.byte1][put.byte<len>][put.error]
|
||||||
|
'' : handleidx - lfd. Nr. der Verbindung
|
||||||
|
'' : len - Anzahl zu empfangender Bytes
|
||||||
|
'' : error - ungleich Null bei Fehler
|
||||||
|
|
||||||
|
error := FALSE
|
||||||
|
handleidx := bus_getchar
|
||||||
|
len := sub_getlong
|
||||||
|
|
||||||
|
repeat len
|
||||||
|
ifnot error
|
||||||
|
repeat while (rxbyte := sock.readByteNonBlocking(sockhandle[handleidx])) < 0
|
||||||
|
ifnot sock.isConnected(sockhandle[handleidx])
|
||||||
|
error := sock#ERRSOCKETCLOSED
|
||||||
|
quit
|
||||||
|
bus_putchar(rxbyte)
|
||||||
|
|
||||||
|
bus_putchar(error)
|
||||||
|
|
||||||
PRI lan_txflush
|
PRI lan_txflush
|
||||||
PRI lan_txcheck | handleidx, txbyte
|
PRI lan_txcheck | handleidx, txbyte
|
||||||
''funktionsgruppe : lan
|
''funktionsgruppe : lan
|
||||||
|
@ -1371,9 +1394,6 @@ PRI lan_txdata | handleidx, len, txbyte, error
|
||||||
|
|
||||||
bus_putchar(error)
|
bus_putchar(error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DAT
|
DAT
|
||||||
long ' long alignment for addresses
|
long ' long alignment for addresses
|
||||||
ip_addr byte 10, 1, 1, 1 'ip
|
ip_addr byte 10, 1, 1, 1 'ip
|
||||||
|
|
|
@ -71,11 +71,12 @@ PUB main
|
||||||
ifnot ftpconnect
|
ifnot ftpconnect
|
||||||
ifnot ftplogin(string("anonymous"),string("password"))
|
ifnot ftplogin(string("anonymous"),string("password"))
|
||||||
ifnot ftpcwd(string("system"))
|
ifnot ftpcwd(string("system"))
|
||||||
ifnot filename[0] == 0
|
ifnot byte[filename][0] == 0
|
||||||
if ftppasv
|
if ftppasv
|
||||||
ftpretr
|
ftpretr
|
||||||
|
|
||||||
|
|
||||||
|
ftpclose
|
||||||
ios.stop
|
ios.stop
|
||||||
|
|
||||||
PRI ftpconnect
|
PRI ftpconnect
|
||||||
|
@ -107,6 +108,15 @@ PRI ftpconnect
|
||||||
return(-1)
|
return(-1)
|
||||||
return(0)
|
return(0)
|
||||||
|
|
||||||
|
PRI ftpclose
|
||||||
|
|
||||||
|
if handleidx_control
|
||||||
|
ios.lan_close(handleidx_control)
|
||||||
|
handleidx_control := 0
|
||||||
|
if handleidx_data
|
||||||
|
ios.lan_close(handleidx_data)
|
||||||
|
handleidx_data := 0
|
||||||
|
|
||||||
PRI ftplogin(username, password)
|
PRI ftplogin(username, password)
|
||||||
|
|
||||||
ifnot strsize(username)
|
ifnot strsize(username)
|
||||||
|
@ -182,17 +192,52 @@ PRI ftppasv : port | i, k, port256, port1
|
||||||
ios.printnl
|
ios.printnl
|
||||||
return(0)
|
return(0)
|
||||||
|
|
||||||
PRI ftpretr
|
PRI ftpretr | len
|
||||||
|
|
||||||
|
if sendStr(string("SIZE ")) || sendStr(filename) || sendStr(string(13,10))
|
||||||
|
ios.print(string("Fehler beim Senden des SIZE-Kommandos"))
|
||||||
|
ios.printnl
|
||||||
|
return(-1)
|
||||||
|
ifnot getResponse(string("213"))
|
||||||
|
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten."))
|
||||||
|
ios.printnl
|
||||||
|
return(-1)
|
||||||
|
ifnot(len := num.FromStr(@strTemp+4, num#DEC))
|
||||||
|
return(-1)
|
||||||
|
|
||||||
|
if sendStr(string("TYPE I",13,10))
|
||||||
|
ios.print(string("Fehler beim Senden des Types"))
|
||||||
|
ios.printnl
|
||||||
|
return(-1)
|
||||||
|
ifnot getResponse(string("200 "))
|
||||||
|
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten."))
|
||||||
|
ios.printnl
|
||||||
|
return(-1)
|
||||||
|
|
||||||
if sendStr(string("RETR ")) || sendStr(filename) || sendStr(string(13,10))
|
if sendStr(string("RETR ")) || sendStr(filename) || sendStr(string(13,10))
|
||||||
ios.print(string("Fehler beim Senden des Filenamens"))
|
ios.print(string("Fehler beim Senden des Filenamens"))
|
||||||
return -1
|
return -1
|
||||||
|
ifnot getResponse(string("150 "))
|
||||||
|
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten."))
|
||||||
|
ios.printnl
|
||||||
|
return(-1)
|
||||||
|
|
||||||
|
if ios.lan_rxdata(handleidx_data, filename, len)
|
||||||
|
ios.print(string("Fehler beim Empfang der Datei."))
|
||||||
|
ios.printnl
|
||||||
|
return(-1)
|
||||||
|
|
||||||
|
ifnot getResponse(string("226 "))
|
||||||
|
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten."))
|
||||||
|
ios.printnl
|
||||||
|
return(-1)
|
||||||
|
|
||||||
PRI download (parameter) | i 'filename kopieren
|
PRI download (parameter) | i 'filename kopieren
|
||||||
|
|
||||||
repeat strsize(filename)
|
repeat strsize(parameter)
|
||||||
filename[i] := parameter[i]
|
byte[filename][i] := byte[parameter][i]
|
||||||
i++
|
i++
|
||||||
|
byte[filename][i] := 0
|
||||||
|
|
||||||
PRI setaddr (ipaddr) | pos, count 'IP-Adresse in Variable schreiben
|
PRI setaddr (ipaddr) | pos, count 'IP-Adresse in Variable schreiben
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue