Python
                
              쓰레드를 이용한 다중 클라이언트 소켓
                kcrong
                 2015. 5. 5. 01:16
              
                          
            | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #-*-coding:utf-8-*- from socket import * from thread import * from threading import * def handler(clientsock,addr):     while 1:         data = clientsock.recv(BUFSIZ)         if not data:             clientsock.close()             break         print data #clientsock.send("echoed:.." + data) if __name__=="__main__":     HOST = "192.168.0.31"     PORT = 10101     BUFSIZ = 1024     ADDR = (HOST,PORT)     serversock = socket(AF_INET,SOCK_STREAM)     serversock.bind(ADDR)     serversock.listen(2)     while 1:         print "waiting for connection..."         clientsock, addr = serversock.accept()         print "...connected from:", addr         start_new_thread(handler,(clientsock, addr)) | cs | 
전 소스와 다른 점을 모르겠으나,
다만 이 소스는 돌아가고 첫 번째 소스는 두번째 쓰레드로 연결이 몰린다.
좀더 공부가 필요할 것 같다..