[issue43516] python on raspberry pi
Yann Enoti
report at bugs.python.org
Tue Mar 16 11:50:02 EDT 2021
New submission from Yann Enoti <gyenoti at gmail.com>:
Any idea why this doesnt work ?
import socket
HOST = "192.168.2.114"
PORT = 8000 #initiate port no above 1024
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print('Socket created')
#try:
s.bind((HOST, PORT)) #bind host address and port together#
#except socket.error as e:
#print('Bind failed.')
s.listen(10) #configure how many clients the server can listen to simultaneously
print("Socket is Listening")
#conn, addr = s.accept() #accept new connection
#print("connection from:" + str(addr))
while True:
conn, addr = s.accept() #accept new connection
print("connection from:" + str(addr))
data = conn.recv(1024).decode() #receive data stream
#if not data: #if data is not received break
# break
print("from Android App:" + str(data))
data = input ('from Python Server:')
conn.send(data.encode()) #send data to client
conn.close() #close the connection
----------
components: Build
messages: 388850
nosy: gyenoti
priority: normal
severity: normal
status: open
title: python on raspberry pi
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43516>
_______________________________________
More information about the Python-bugs-list
mailing list