handle is long (not byte)
This commit is contained in:
parent
ab60f86a32
commit
51ec2c7c47
@ -1054,7 +1054,7 @@ PUB lan_connect(ipaddr, remoteport): handle
|
|||||||
'' : (driver_socket.spin handelt per default bis 4 Sockets)
|
'' : (driver_socket.spin handelt per default bis 4 Sockets)
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [073][sub_putlong.ipaddr][sub_putword.remoteport][get.handle]
|
''busprotokoll : [073][sub_putlong.ipaddr][sub_putword.remoteport][sub_getlong.handle]
|
||||||
'' : ipaddr - ipv4 address packed into a long (ie: 1.2.3.4 => $01_02_03_04)
|
'' : ipaddr - ipv4 address packed into a long (ie: 1.2.3.4 => $01_02_03_04)
|
||||||
'' : remoteport - port number to connect to
|
'' : remoteport - port number to connect to
|
||||||
'' : handle - lfd. Nr. der Verbindung
|
'' : handle - lfd. Nr. der Verbindung
|
||||||
@ -1062,7 +1062,7 @@ PUB lan_connect(ipaddr, remoteport): handle
|
|||||||
bus_putchar1(gc#a_lanConnect)
|
bus_putchar1(gc#a_lanConnect)
|
||||||
bus_putlong1(ipaddr)
|
bus_putlong1(ipaddr)
|
||||||
bus_putword1(remoteport)
|
bus_putword1(remoteport)
|
||||||
handle := bus_getchar1
|
handle := bus_getlong1
|
||||||
|
|
||||||
PUB lan_listen
|
PUB lan_listen
|
||||||
PUB lan_relisten
|
PUB lan_relisten
|
||||||
@ -1071,12 +1071,12 @@ PUB lan_isconnected(handle): connected
|
|||||||
''funktion : Abfrage, ob Socket verbunden
|
''funktion : Abfrage, ob Socket verbunden
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [076][put.handle][get.connected]
|
''busprotokoll : [076][sub_putlong.handle][get.connected]
|
||||||
'' : handle - lfd. Nr. der zu testenden Verbindung
|
'' : handle - lfd. Nr. der zu testenden Verbindung
|
||||||
'' : connected - True, if connected
|
'' : connected - True, if connected
|
||||||
|
|
||||||
bus_putchar1(gc#a_lanIsConnected)
|
bus_putchar1(gc#a_lanIsConnected)
|
||||||
bus_putchar1(handle)
|
bus_putlong1(handle)
|
||||||
connected := bus_getchar1
|
connected := bus_getchar1
|
||||||
|
|
||||||
PUB lan_rxcount
|
PUB lan_rxcount
|
||||||
@ -1085,24 +1085,24 @@ PUB lan_resetbuffers(handle)
|
|||||||
''funktion : Sende- und Empfangspuffer zurücksetzen
|
''funktion : Sende- und Empfangspuffer zurücksetzen
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [078][put.handle]
|
''busprotokoll : [078][sub_putlong.handle]
|
||||||
'' : handle - lfd. Nr. der Verbindung
|
'' : handle - lfd. Nr. der Verbindung
|
||||||
|
|
||||||
bus_putchar1(gc#a_lanResetBuffers)
|
bus_putchar1(gc#a_lanResetBuffers)
|
||||||
bus_putchar1(handle)
|
bus_putlong1(handle)
|
||||||
|
|
||||||
PUB lan_waitconntimeout(handle, timeout): connected
|
PUB lan_waitconntimeout(handle, timeout): connected
|
||||||
''funktionsgruppe : lan
|
''funktionsgruppe : lan
|
||||||
''funktion : bestimmte Zeit auf Verbindung warten
|
''funktion : bestimmte Zeit auf Verbindung warten
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [079][put.handle][sub_putword.timeout][get.connected]
|
''busprotokoll : [079][sub_putlong.handle][sub_putword.timeout][get.connected]
|
||||||
'' : handle - lfd. Nr. der zu testenden Verbindung
|
'' : handle - lfd. Nr. der zu testenden Verbindung
|
||||||
'' : timeout - Timeout in Millisekunden
|
'' : timeout - Timeout in Millisekunden
|
||||||
'' : connected - True, if connected
|
'' : connected - True, if connected
|
||||||
|
|
||||||
bus_putchar1(gc#a_lanWaitConnTimeout)
|
bus_putchar1(gc#a_lanWaitConnTimeout)
|
||||||
bus_putchar1(handle)
|
bus_putlong1(handle)
|
||||||
bus_putword1(timeout)
|
bus_putword1(timeout)
|
||||||
connected := bus_getchar1
|
connected := bus_getchar1
|
||||||
|
|
||||||
@ -1111,11 +1111,11 @@ PUB lan_close(handle)
|
|||||||
''funktion : TCP-Verbindung (ein- oder ausgehend) schließen
|
''funktion : TCP-Verbindung (ein- oder ausgehend) schließen
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [080][put.handle]
|
''busprotokoll : [080][sub_putlong.handle]
|
||||||
'' : handle - lfd. Nr. der zu schließenden Verbindung
|
'' : handle - lfd. Nr. der zu schließenden Verbindung
|
||||||
|
|
||||||
bus_putchar1(gc#a_lanClose)
|
bus_putchar1(gc#a_lanClose)
|
||||||
bus_putchar1(handle)
|
bus_putlong1(handle)
|
||||||
|
|
||||||
PUB lan_rxflush
|
PUB lan_rxflush
|
||||||
PUB lan_rxcheck(handle): rxbyte
|
PUB lan_rxcheck(handle): rxbyte
|
||||||
@ -1125,14 +1125,14 @@ PUB lan_rxcheck(handle): rxbyte
|
|||||||
'' : (vor allem nicht, wenn -1 und -3 enthalten sein können)
|
'' : (vor allem nicht, wenn -1 und -3 enthalten sein können)
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [082][put.handle][get.rxbyte]
|
''busprotokoll : [082][sub_putlong.handle][get.rxbyte]
|
||||||
'' : handle - lfd. Nr. der Verbindung
|
'' : handle - lfd. Nr. der Verbindung
|
||||||
'' : rxbyte - empfangenes Zeichen (0 - 127) oder
|
'' : rxbyte - empfangenes Zeichen (0 - 127) oder
|
||||||
'' : sock#RETBUFFEREMPTY (-1) wenn Puffer leer
|
'' : sock#RETBUFFEREMPTY (-1) wenn Puffer leer
|
||||||
'' : sock#ERRSOCKETCLOSED (-3) wenn keine Verbindung mehr
|
'' : sock#ERRSOCKETCLOSED (-3) wenn keine Verbindung mehr
|
||||||
|
|
||||||
bus_putchar1(gc#a_lanRXCheck)
|
bus_putchar1(gc#a_lanRXCheck)
|
||||||
bus_putchar1(handle)
|
bus_putlong1(handle)
|
||||||
rxbyte := bus_getchar1
|
rxbyte := bus_getchar1
|
||||||
|
|
||||||
PUB lan_rxtime(handle, timeout): rxbyte
|
PUB lan_rxtime(handle, timeout): rxbyte
|
||||||
@ -1141,14 +1141,14 @@ PUB lan_rxtime(handle, timeout): rxbyte
|
|||||||
'' : nicht verwenden, wenn anderes als ASCII (0 - 127) empfangen wird
|
'' : nicht verwenden, wenn anderes als ASCII (0 - 127) empfangen wird
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [083][put.handle][sub_putword.timeout][get.rxbyte]
|
''busprotokoll : [083][sub_putlong.handle][sub_putword.timeout][get.rxbyte]
|
||||||
'' : handle - lfd. Nr. der Verbindung
|
'' : handle - lfd. Nr. der Verbindung
|
||||||
'' : timeout - Timeout in Millisekunden
|
'' : timeout - Timeout in Millisekunden
|
||||||
'' : rxbyte - empfangenes Zeichen (0 - 127) oder
|
'' : rxbyte - empfangenes Zeichen (0 - 127) oder
|
||||||
'' : sock#RETBUFFEREMPTY (-1) wenn Timeout oder keine Verbindung mehr
|
'' : sock#RETBUFFEREMPTY (-1) wenn Timeout oder keine Verbindung mehr
|
||||||
|
|
||||||
bus_putchar1(gc#a_lanRXTime)
|
bus_putchar1(gc#a_lanRXTime)
|
||||||
bus_putchar1(handle)
|
bus_putlong1(handle)
|
||||||
bus_putword1(timeout)
|
bus_putword1(timeout)
|
||||||
rxbyte := bus_getchar1
|
rxbyte := bus_getchar1
|
||||||
|
|
||||||
@ -1163,13 +1163,13 @@ PUB lan_txcheck(handle, txbyte): error
|
|||||||
'' : (vor allem nicht, wenn -1 enthalten sein kann)
|
'' : (vor allem nicht, wenn -1 enthalten sein kann)
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [088][put.handle][put.tybyte][get.error]
|
''busprotokoll : [088][sub_putlong.handle][put.tybyte][get.error]
|
||||||
'' : handle - lfd. Nr. der Verbindung
|
'' : handle - lfd. Nr. der Verbindung
|
||||||
'' : txbyte - zu sendendes Zeichen
|
'' : txbyte - zu sendendes Zeichen
|
||||||
'' : error - ungleich Null bei Fehler
|
'' : error - ungleich Null bei Fehler
|
||||||
|
|
||||||
bus_putchar1(gc#a_lanTXCheck)
|
bus_putchar1(gc#a_lanTXCheck)
|
||||||
bus_putchar1(handle)
|
bus_putlong1(handle)
|
||||||
bus_putchar1(txbyte)
|
bus_putchar1(txbyte)
|
||||||
error := bus_getchar1
|
error := bus_getchar1
|
||||||
|
|
||||||
|
@ -1182,7 +1182,7 @@ PRI lan_connect | ipaddr, remoteport, handle
|
|||||||
'' : (driver_socket.spin handelt per default bis 4 Sockets)
|
'' : (driver_socket.spin handelt per default bis 4 Sockets)
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [073][sub_getlong.ipaddr][sub_getword.remoteport][put.handle]
|
''busprotokoll : [073][sub_getlong.ipaddr][sub_getword.remoteport][sub_putlong.handle]
|
||||||
'' : ipaddr - ipv4 address packed into a long (ie: 1.2.3.4 => $01_02_03_04)
|
'' : ipaddr - ipv4 address packed into a long (ie: 1.2.3.4 => $01_02_03_04)
|
||||||
'' : remoteport - port number to connect to
|
'' : remoteport - port number to connect to
|
||||||
'' : handle - lfd. Nr. der Verbindung
|
'' : handle - lfd. Nr. der Verbindung
|
||||||
@ -1192,7 +1192,7 @@ PRI lan_connect | ipaddr, remoteport, handle
|
|||||||
|
|
||||||
handle := sock.connect(ipaddr, remoteport, @bufrxconn, rxlen, @buftxconn, txlen)
|
handle := sock.connect(ipaddr, remoteport, @bufrxconn, rxlen, @buftxconn, txlen)
|
||||||
|
|
||||||
bus_putchar(handle) 'handle senden
|
sub_putlong(handle) 'handle senden
|
||||||
|
|
||||||
|
|
||||||
PRI lan_listen
|
PRI lan_listen
|
||||||
@ -1202,11 +1202,11 @@ PRI lan_isconnected | handle
|
|||||||
''funktion : Abfrage, ob Socket verbunden
|
''funktion : Abfrage, ob Socket verbunden
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [076][get.handle][put.connected]
|
''busprotokoll : [076][sub_getlong.handle][put.connected]
|
||||||
'' : handle - lfd. Nr. der zu testenden Verbindung
|
'' : handle - lfd. Nr. der zu testenden Verbindung
|
||||||
'' : connected - True, if connected
|
'' : connected - True, if connected
|
||||||
|
|
||||||
handle := bus_getchar
|
handle := sub_getlong
|
||||||
|
|
||||||
bus_putchar(sock.isConnected(handle))
|
bus_putchar(sock.isConnected(handle))
|
||||||
|
|
||||||
@ -1216,10 +1216,10 @@ PRI lan_resetbuffers | handle
|
|||||||
''funktion : Sende- und Empfangspuffer zurücksetzen
|
''funktion : Sende- und Empfangspuffer zurücksetzen
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [078][get.handle]
|
''busprotokoll : [078][sub_getlong.handle]
|
||||||
'' : handle - lfd. Nr. der Verbindung
|
'' : handle - lfd. Nr. der Verbindung
|
||||||
|
|
||||||
handle := bus_getchar
|
handle := sub_getlong
|
||||||
|
|
||||||
sock.resetBuffers(handle)
|
sock.resetBuffers(handle)
|
||||||
|
|
||||||
@ -1228,12 +1228,12 @@ PRI lan_waitconntimeout | handle, timeout, t, connected
|
|||||||
''funktion : bestimmte Zeit auf Verbindung warten
|
''funktion : bestimmte Zeit auf Verbindung warten
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [079][get.handle][sub_getword.timeout][put.connected]
|
''busprotokoll : [079][sub_getlong.handle][sub_getword.timeout][put.connected]
|
||||||
'' : handle - lfd. Nr. der zu testenden Verbindung
|
'' : handle - lfd. Nr. der zu testenden Verbindung
|
||||||
'' : timeout - Timeout in Millisekunden
|
'' : timeout - Timeout in Millisekunden
|
||||||
'' : connected - True, if connected
|
'' : connected - True, if connected
|
||||||
|
|
||||||
handle := bus_getchar
|
handle := sub_getlong
|
||||||
timeout := sub_getword
|
timeout := sub_getword
|
||||||
|
|
||||||
t := cnt
|
t := cnt
|
||||||
@ -1246,10 +1246,10 @@ PRI lan_close | handle
|
|||||||
''funktion : TCP-Verbindung (ein- oder ausgehend) schließen
|
''funktion : TCP-Verbindung (ein- oder ausgehend) schließen
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [080][get.handle]
|
''busprotokoll : [080][sub_getlong.handle]
|
||||||
'' : handle - lfd. Nr. der zu schließenden Verbindung
|
'' : handle - lfd. Nr. der zu schließenden Verbindung
|
||||||
|
|
||||||
handle := bus_getchar
|
handle := sub_getlong
|
||||||
|
|
||||||
sock.close(handle)
|
sock.close(handle)
|
||||||
|
|
||||||
@ -1261,13 +1261,13 @@ PRI lan_rxcheck | handle, rxbyte
|
|||||||
'' : (vor allem nicht, wenn -1 und -3 enthalten sein können)
|
'' : (vor allem nicht, wenn -1 und -3 enthalten sein können)
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [082][get.handle][put.rxbyte]
|
''busprotokoll : [082][sub_getlong.handle][put.rxbyte]
|
||||||
'' : handle - lfd. Nr. der Verbindung
|
'' : handle - lfd. Nr. der Verbindung
|
||||||
'' : rxbyte - empfangenes Zeichen (0 - 127) oder
|
'' : rxbyte - empfangenes Zeichen (0 - 127) oder
|
||||||
'' : sock#RETBUFFEREMPTY (-1) wenn Puffer leer
|
'' : sock#RETBUFFEREMPTY (-1) wenn Puffer leer
|
||||||
'' : sock#ERRSOCKETCLOSED (-3) wenn keine Verbindung mehr
|
'' : sock#ERRSOCKETCLOSED (-3) wenn keine Verbindung mehr
|
||||||
|
|
||||||
handle := bus_getchar
|
handle := sub_getlong
|
||||||
|
|
||||||
rxbyte := sock.readByteNonBlocking(handle)
|
rxbyte := sock.readByteNonBlocking(handle)
|
||||||
if (not sock.isConnected(handle)) and (rxbyte == -1)
|
if (not sock.isConnected(handle)) and (rxbyte == -1)
|
||||||
@ -1281,13 +1281,13 @@ PRI lan_rxtime | handle, timeout, t, rxbyte
|
|||||||
'' : nicht verwenden, wenn anderes als ASCII (0 - 127) empfangen wird
|
'' : nicht verwenden, wenn anderes als ASCII (0 - 127) empfangen wird
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [083][get.handle][sub_getword.timeout][put.rxbyte]
|
''busprotokoll : [083][sub_getlong.handle][sub_getword.timeout][put.rxbyte]
|
||||||
'' : handle - lfd. Nr. der Verbindung
|
'' : handle - lfd. Nr. der Verbindung
|
||||||
'' : timeout - Timeout in Millisekunden
|
'' : timeout - Timeout in Millisekunden
|
||||||
'' : rxbyte - empfangenes Zeichen (0 - 127) oder
|
'' : rxbyte - empfangenes Zeichen (0 - 127) oder
|
||||||
'' : sock#RETBUFFEREMPTY (-1) wenn Timeout oder keine Verbindung mehr
|
'' : sock#RETBUFFEREMPTY (-1) wenn Timeout oder keine Verbindung mehr
|
||||||
|
|
||||||
handle := bus_getchar
|
handle := sub_getlong
|
||||||
timeout := sub_getword
|
timeout := sub_getword
|
||||||
|
|
||||||
t := cnt
|
t := cnt
|
||||||
@ -1306,12 +1306,12 @@ PRI lan_txcheck | handle, txbyte
|
|||||||
'' : (vor allem nicht, wenn -1 enthalten sein kann)
|
'' : (vor allem nicht, wenn -1 enthalten sein kann)
|
||||||
''eingabe : -
|
''eingabe : -
|
||||||
''ausgabe : -
|
''ausgabe : -
|
||||||
''busprotokoll : [088][get.handle][get.tybyte][put.error]
|
''busprotokoll : [088][sub_getlong.handle][get.tybyte][put.error]
|
||||||
'' : handle - lfd. Nr. der Verbindung
|
'' : handle - lfd. Nr. der Verbindung
|
||||||
'' : txbyte - zu sendendes Zeichen
|
'' : txbyte - zu sendendes Zeichen
|
||||||
'' : error - ungleich Null bei Fehler
|
'' : error - ungleich Null bei Fehler
|
||||||
|
|
||||||
handle := bus_getchar
|
handle := sub_getlong
|
||||||
txbyte := bus_getchar
|
txbyte := bus_getchar
|
||||||
|
|
||||||
ifnot sock.isConnected(handle)
|
ifnot sock.isConnected(handle)
|
||||||
|
@ -46,8 +46,8 @@ VAR
|
|||||||
byte parastr[64]
|
byte parastr[64]
|
||||||
byte strTemp[128]
|
byte strTemp[128]
|
||||||
byte addrset
|
byte addrset
|
||||||
byte handle_control 'Handle FTP Control Verbindung
|
long handle_control 'Handle FTP Control Verbindung
|
||||||
byte handle_data 'Handle FTP Data Verbindung
|
long handle_data 'Handle FTP Data Verbindung
|
||||||
|
|
||||||
PUB main
|
PUB main
|
||||||
|
|
||||||
@ -68,16 +68,15 @@ PUB main
|
|||||||
ios.print(string("Starte LAN..."))
|
ios.print(string("Starte LAN..."))
|
||||||
ios.printnl
|
ios.printnl
|
||||||
ios.lanstart
|
ios.lanstart
|
||||||
delay_ms(5000) 'nach ios.lanstart dauert es, bis der Stack funktioniert
|
delay_ms(1000) 'nach ios.lanstart dauert es, bis der Stack funktioniert
|
||||||
ios.print(string("Verbinde mit FTP-Server..."))
|
ios.print(string("Verbinde mit FTP-Server..."))
|
||||||
ios.printnl
|
ios.printnl
|
||||||
handle_control := ios.lan_connect(ip_addr, 21)
|
handle_control := ios.lan_connect(ip_addr, 21)
|
||||||
ios.lan_resetbuffers(handle_control)
|
'' ios.lan_resetbuffers(handle_control)
|
||||||
ios.print(string("Handle Connect: "))
|
ios.print(string("Handle Connect: "))
|
||||||
ios.print(num.ToStr(handle_control, num#DEC))
|
ios.print(num.ToStr(handle_control, num#HEX))
|
||||||
ios.printnl
|
ios.printnl
|
||||||
if (ios.lan_waitconntimeout(handle_control, 2000))
|
if (ios.lan_waitconntimeout(handle_control, 2000))
|
||||||
delay_ms(5000)
|
|
||||||
ios.print(string("Verbindung mit FTP-Server hergestellt."))
|
ios.print(string("Verbindung mit FTP-Server hergestellt."))
|
||||||
ios.printnl
|
ios.printnl
|
||||||
if getResponse(string("220 "))
|
if getResponse(string("220 "))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user