Server not working for multiple clients
Question: Please tell me what is the problem with my server code. It is not working for
the two clients simultaneously. It is running only for the client that I run
first. I am new to python and socket programming. Kindly help me out here.

    
    
    import socket
    import sys
    import thread
    import time
    # Create a TCP/IP socket
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    
    # Bind the socket to the address given on the command line
    server_address = ('127.0.0.1', 10001)
    data = " ".join(sys.argv[1:])
    sock.bind(server_address)
    print >>sys.stderr, 'starting up on %s port %s' % sock.getsockname()
    sock.listen(1)
    connection, client_address = sock.accept()
    def my(threadName , delay):
    
        while True:
            print >>sys.stderr, 'waiting for a connection'
    
            try:
                print >>sys.stderr, 'client connected:', client_address
                while True:
                    data = connection.recv(16)
                    print >>sys.stderr, 'received "%s"' % data
                    a=['a' ,'e', 'i' , 'o' , 'u']
                    for i in data:
                        if i in a:
                            data = data.replace(i, '')
    
                            data=data.upper()
                            print data
    
    
                    print'\nUpper case string:'
    
                    if data:
                        connection.sendall(data)
                    else:
                        break
            finally:
                connection.close()
    
    
    thread.start_new_thread(my , ("Thread-1" , 8,))
    thread.start_new_thread(my , ("Thread-2" , 10,))
    


Answer: Have a look at **socketServer** module it easy to use for multiple clients
<https://docs.python.org/3.4/library/socketserver.html>

