Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
191 views
in Technique[技术] by (71.8m points)

Client-Server socket communication between Android and Python?

I would like to use sockets for a client-server communication between Python and Android. Currently I established a connection from Android to the Python server. This works well. I can also send messages to the server. Now I tried to send a response to Android.

The python code:

 clientsocket.send(bytes("Testmessage","UTF-8"))

There is no error. In the Android app, I tried to get the result via BufferedReader:

BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
Log.e("Test",""+in.read()); // returns 84
Log.e("Test2",""+in.readLine()); // no console output

Any idea how I could fix it?

question from:https://stackoverflow.com/questions/65651564/client-server-socket-communication-between-android-and-python

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...