New submission from Yann Enoti <gyen...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue43516>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to