Server.py
1 |
#!/usr/bin/env python3
|
---|---|
2 |
import socket |
3 |
from Funciones import * |
4 |
|
5 |
s = socket.socket() |
6 |
print("Socket creado")
|
7 |
port = 8080
|
8 |
s.bind(('', port))
|
9 |
print("El socket se creo con puerto: {}".format(port))
|
10 |
s.listen(5)
|
11 |
print("EL socket is listening....")
|
12 |
connect, addr = s.accept() |
13 |
print("Se conecto a {}".format(addr))
|
14 |
|
15 |
while True: |
16 |
rawByte = connect.recv(1)
|
17 |
char = rawByte.decode('utf-8')
|
18 |
|
19 |
if char == 'w': |
20 |
Adelante() |
21 |
if char == 's': |
22 |
Atras() |
23 |
if char == 'd': |
24 |
Derecha() |
25 |
if char == 'a': |
26 |
Izquierda() |
27 |
if char == 'p': |
28 |
SubirBrazo() |
29 |
if char == 'i': |
30 |
BajarBrazo() |
31 |
if char == 'o': |
32 |
CalibrarBrazo() |
33 |
if char == 'u': |
34 |
Agarrar() |
35 |
if char == 'j': |
36 |
Soltar() |
37 |
if char == ' ': |
38 |
Parar() |
39 |
if char == 'q': |
40 |
print("Terminada la sesion...")
|
41 |
break
|