On Nov 7, 1:54 pm, Tzury Bar Yochay <[EMAIL PROTECTED]> wrote:
> hi, the following sample (from docs.python.org) is a server that can
> actually serve only single client at a time.
>
> In my case I need a simple server that can serve more than one client.
> I couldn't find an example on how to do that and be glad to get a
> hint.
>
> Thanks in advance
>
> import socket
>
> HOST = '127.0.0.1'      # Symbolic name meaning the local host
> PORT = 50007            # Arbitrary non-privileged port
>
> 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(data)
>
> conn.close()

POE

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

Reply via email to