Пример #1
0
	def start_go(self):
		ip_addr = raw_input('What IP (or type listen)?: ')
		name = raw_input('Name:')
		aes_cipher = AESCipher(raw_input('key: '))
		chat = None
		if ip_addr.lower() == 'listen':
			chat = ChatServer(name,aes_cipher)
		else:
			chat = ChatClient(name,aes_cipher)
			chat.host = ip_addr
		player = PlayerChat(name,chat)
		opponent = OpponentChat('Opponent',chat)
		chat.start()
		if ip_addr.lower() == 'listen': go = Go(9,player1=player,player2=opponent)
		else: go = Go(9,player1=opponent,player2=player)
Пример #2
0
	def start_chat(self):
		ip_addr = raw_input('What IP (or type listen)?: ')
		name = raw_input('Name:')
		aes_cipher = AESCipher(raw_input('key: '))
		chat = None
		if ip_addr.lower() == 'listen':
			chat = ChatServer(name,aes_cipher)
		else:
			chat = ChatClient(name,aes_cipher)
			chat.host = ip_addr
		chat.start()
		while True:
			text = raw_input('')
			chat.sendall(text)