danfolkes wrote:

> Why does the message send only once?

Because your server is designed to only accept one connection, wait
forever except there is an exception, and quit thereafter.

> def Server(address):
>     [...]
>     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>     s.bind((HOST, PORT))
>     s.listen(1)                 # ----- set up listening
>     conn, addr = s.accept()     # ----- accept one connection
>     print 'Connected by', addr
>     while 1:
>         print message
>         time.sleep(1)
>         data = conn.recv(1024)  # ----- receive stuff
>         #if not data: break
>         conn.send(data)         # ----- send stuff
>     conn.close()                # ----- close connection
>                                 # ----- quit

Personally, I like the Twisted framework more than low-level socket
interfaces. Consider giving it a try -- your code will be much
easier to read and maintain. You don't have to waste time
implementing the server or client basics but can fully concentrate
on your protocol(s).

Regards,


Björn

-- 
BOFH excuse #168:

le0: no carrier: transceiver cable problem?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to