ich versuche immer noch einen AP/STA-Sketch, der auf dem ESP32 problemlos lief, auf dem D1mini Pro laufen zu lassen.
Im Momnent hängt es an einem formatierten 'print' mit %s %
In allen scripts zu AP/STA steht am Ende dieser Code, der nach der Verbindung mit ssid/passwort ( .isconnected() ) abgearbeitet wird:
Code: Alles auswählen
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', 80))
s.listen(5)
while True:
try:
print('waiting for client request')
conn, addr = s.accept()
print('Got a connection from %s' % str(addr)) #old Syntax
#print('Got a connection from {}'.format((addr))) #new Syntax
request = conn.recv(1024)
print('Content = %s' % str(request)) #old Syntax
#print('Content = {}' .format(str(request))) #new Syntax
response = web_page() #storing html-data from web_page():
conn.send('HTTP/1.1 200 OK\n')
conn.send('Content-Type: text/html\n')
conn.send('Connection: close\n\n')
conn.sendall(response) #send html to client
conn.close()
print('Connection closed', '\n')
except OSError as e:
conn.close()
Code: Alles auswählen
print('Got a connection from %s' % str(addr)) #alte Syntax
#print('Got a connection from {}' .format( str(addr))) #neue Syntax
Diese Anweisung wird auf ESP8266 NICHT ausgeführt (alte und neue Syntax) !
Code: Alles auswählen
print('Content = %s' % str(request))
#print('Content = {}' .format( str(request)))
sonst nichts, C stammt von Content...
Erwartete Antwort: Content = b'GET / HTTP/1.1\r\nHOST: 192.168.4.1\r\nUpgrade- ... \r\nConnection: keep-alive\r\n\r\n'
By the way: der weitere Code wird abgearbeitet, der letzte 'print' bleibt aber aus.
Hat jemand eine Idee, was hier falsch läuft?
mfg