Ok, let's go on with our tries.
Now we can connect, but we cannot exchange data.
In you original py code you wrote:
while 1:
data = conn.recv(1024) # wait for some data
if not data: break # if no data, break
conn.send(data) # resend the same data (is an echo server, or you can conn.send('Hallo world')
conn.send('Hallo world')
For what I see the while loop checks if there is some data available. But IF NOT DATA: BREAK I suppose will will exit the loop.
So I suggest a first test. Replace the last line conn.send('Hallo World') with print ('exit from waiting loop')
This way you can test if the py program stay in the loop waiting or it exists immediately.
The second test is to write your py routine as follow (hope the syntax is correct)
while 1:
data = conn.recv(1024) # wait for some data
if data = 'quit': break
if data: conn.send(data) # resend the same data (is an echo server, or you can conn.send('Hallo world')
print ("End of loop - End routine")
The meaning of this code is:
- Start a never-endig loop with While 1 (or while true, if you prefer)
- Wait for some data
- if the string received is "quit" then break the loop (exit) - is correct data='quit' or is data="quit" (single or double ' ?)
- If there is some data, send back the same data (just echo)
- When you exit the loop, print something
If this works, you should have a 'Connected' in the b4a log
After the 'connected' just send something to the py server and the py server should echo it back
If you send the string 'quit' the py server will exit the wait loop and print "End of Loop..."
Tell me if it works or not...