Пример #1
0
 def run(self):
     try:
         while True:
             print ('tcp server :: server wait...')
             connection, clientAddress = self.serverSocket.accept()
             self.connections.append(connection)
             print ("tcp server :: connect :", clientAddress)
 
             subThread = tcpServerThread.TCPServerThread(self.commandQueue, self.tcpServerThreads, self.connections, connection, clientAddress,self.timeQueue)
             subThread.start()
             self.tcpServerThreads.append(subThread)
     except:
         print ("tcp server :: serverThread error")
Пример #2
0
    def run(self):
        try:
            while True:
                #print('tcp server :: server wait...')
                connection, clientAddress = self.serverSocket.accept()

                print("Client :: ", clientAddress[1], " is connected.")
                subThread = tcpServerThread.TCPServerThread(self.commandQueue, connection, clientAddress)
                subThread.start()
                self.tcpServerThreads[clientAddress[1]%50]=subThread

        except:
            print("Server :: Thread error")
Пример #3
0
	def run(self):
		try:
			while True:
				print 'tcp server :: server wait...'
				connection, clientAddress = self.serverSocket.accept()
				self.connections.append(connection)
				print 'tcp server :: connect : ', clientAddress

				subThread = tcpServerThread.TCPServerThread(self.commandQueue, self.tcpServerThreads, self.connections, connection, clientAddress)
				subThread.start()
				self.tcpServerThreads.append(subThread)
			
		except KeyboardInterrupt:
			serverSocket.close()
			sys.exit()
Пример #4
0
    def run(self):
        try:
            while True:
                print('tcp server :: server wait...')
                socket, clientAddress = self.serverSocket.accept()
                self.connections.append(socket)
                print("tcp server :: connect :", clientAddress)

                #클라이언트 별로 스레드 생성
                subThread = tcpServerThread.TCPServerThread(
                    self.tcpServerThreads, self.connections, socket,
                    clientAddress)
                subThread.start()
                self.tcpServerThreads.append(subThread)
        except:
            print("tcp server :: serverThread error")
Пример #5
0
    def run(self):
        try:
            while True:
                ipaddr = socket.gethostbyname(socket.getfqdn())
                print('The IP address of this server is [', ipaddr, ']')
                print('tcp server :: server wait...')
                connection, clientAddress = self.serverSocket.accept()
                self.connections.append(connection)
                print("tcp server :: connect :", clientAddress)

                subThread = tcpServerThread.TCPServerThread(
                    self.commandQueue, self.tcpServerThreads, self.connections,
                    connection, clientAddress)
                subThread.start()
                self.tcpServerThreads.append(subThread)
        except:
            print("tcp server :: serverThread error")
Пример #6
0
    def run(self):
        # Bind socket to host and port

        try:
            while True:
                print('Server wait...')
                connection, clntAddr = self.s.accept()
                self.connections.append(connection)
                print()
                print('Connect with ', clntAddr[0], ':', str(clntAddr[1]))

                subThread = tcpServerThread.TCPServerThread(
                    self.tcpServerThreads, self.connections, connection,
                    clntAddr)
                subThread.start()
                self.tcpServerThreads.append(subThread)
        except:
            print('TCP server :: serverThread error')
        self.s.close()
Пример #7
0
    def run(self):
        try:
            while True:
                print('[+] Server wait...')

                #클라이언트의 접속 수락
                #누군가가 접속하여 연결되었을 때 비로소 결과 값이 return 되는 함수
                #누군가 접속하기 전까지 이 부분에서 멈춰있음. connection을 통해 앞으로 통신을 진행
                connection, clientAddress = self.serverSocket.accept()

                self.connections.append(connection)
                print('[+] Conneted  : {}'.format(clientAddress))

                subThread = tcpServerThread.TCPServerThread(
                    self.tcpServerThreads, self.connections, connection,
                    clientAddress)
                subThread.start()
                self.tcpServerThreads.append(subThread)
        except:
            print("[!] ServerThread error")