Another Socket in Python

Juza r0bbie at libero.it
Sat Aug 17 16:45:10 CEST 2002


It's the same old problem in my code:
import time
import socket
HOST = ''
PORT = 50007
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connected by', addr
while 1:
    data = conn.recv(1024)
    if not data: break
    conn.send("Tutto OK")
conn.close()
time.sleep(10)

i need a script that every second after the server is in LISTEM print on the
screen * until a client is logged in.
I have try with the module select but i'm not able to do it.
Any hint?






More information about the Python-list mailing list