Server and Client Socket problem

Diez B. Roggisch nospam-deets at web.de
Fri Jan 23 08:05:11 EST 2004


Hi,


> import socket
>         def run():
> servidor = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> servidor.bind(('localhost', 6969))
> servidor.listen(1)
> while 1:
>  (conexion, direccion) = servidor.accept()
> datos = conexion.recv(4069)
>  print "Servidor Recibe", datos
>                 if datos == "quit":
>                     servidor.close()
>                 break
> 
>         run()

This code can obviously not run, as its not properly indented. I'm sure that
indentation got somehow lost when you create the posting, but as long as
you don't provide it in a executable fashion, we can't help you.

However, as someone beeing recently converted from hand-made socket
programming to twisted, I suggest instead of working with sockets yourself,
you better investigate into the twisted framework. Its very well
documented.

Regards,

Diez B. Roggisch



More information about the Python-list mailing list