Skip to content
Snippets Groups Projects
Commit 605d3c38 authored by Fernando Erd's avatar Fernando Erd :ok_hand:
Browse files

send hostname to server

parent a3c28f7d
Branches
No related tags found
No related merge requests found
......@@ -20,19 +20,22 @@ def client ():
dest = (HOST, PORT)
print 'Para sair digite exit\n'
print 'Escreva a mensagem'
print 'Mensagem:'
msg = raw_input()
if msg != 'exit':
print 'Qual a Prioridade?'
print 'Prioridade:'
priority = raw_input ()
hostname = socket.gethostname() # Pega o hostname
while msg <> 'exit':
udp.sendto (msg, dest)
print 'Escreva a mensagem'
udp.sendto (hostname, dest) # Envia Hostname
udp.sendto (msg, dest) #Envia Mensagem
print 'Mensagem:'
msg = raw_input()
if msg != 'exit':
print 'Qual a Prioridade?'
print 'Prioridade:'
priority = raw_input ()
hostname = socket.gethostname()
t.stop ()
udp.close()
......
......@@ -5,6 +5,7 @@ udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
orig = (HOST, PORT)
udp.bind(orig)
while True:
msg, cliente = udp.recvfrom(1024)
print cliente, msg
hostname, cliente_ip= udp.recvfrom (1024)
msg,client_ip = udp.recvfrom(1024)
print hostname, ':', msg
udp.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment