Skip to content

Commit

Permalink
Update server.py
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielavmattos-zz authored Jul 5, 2016
1 parent bd4101d commit 83c617d
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions serverEdison/server.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import subprocess
import os
import socket
HOST = '192.168.0.225' # Endereco IP do Servidor
PORT = 5000 # Porta que o Servidor esta
udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
orig = (HOST, PORT)
udp.bind(orig)
while True:
msg, cliente = udp.recvfrom(1024)
HOST = '192.168.43.168' # Endereco IP do Servidor
PORT = 5000 # Porta que o Servidor esta
udp = socket.socket()

udp.bind((HOST,PORT))
udp.listen(5)

if (msg == "esquerda"):
print "esquerda"

if (msg == "direita"):
print "direita"
print cliente, msg
while True:
conn, addr = udp.accept()
print(str(addr))
msg = conn.recv(1024)
if (len(msg) > 0):
print (msg)
nomeA = "saida.py"
arquivo = open(nomeA, 'w')
arquivo.write(msg)
arquivo.close()
said = execfile("saida.py")
print (said)
udp.close()

0 comments on commit 83c617d

Please sign in to comment.