Project

General

Profile

server.py

Vranika Santiago, 12/04/2022 06:44 PM

Download (863 Bytes)

 
1
import socket
2
from Function import *
3
s = socket.socket()
4
print("Socket creado")
5
port = 19999
6
s.bind( ("", port) )
7
print("El socket se creo con puerto:{}".format(port))
8
s.listen(5)
9
print("EL socket is listening....")
10
connect, addr = s.accept()
11
print("Se conecto a {}".format(addr))
12
while True:
13
    rawByte = connect.recv(1)
14
    char = rawByte.decode('utf-8')
15
    if (char == 'w'):
16
        moveUp()
17
    if (char == 's'):
18
        moveDown()
19
    if (char == 'd'):
20
        moveRight()
21
    if (char == 'a'):
22
        moveLeft()
23
    if (char == 'p'):
24
        Disparar()
25
    if (char == 'f'):
26
        Luciano()  
27
    if (char == 'i'):
28
        Inclinacion45()
29
    if (char == 'o'):
30
        Inclinacion0()
31
    if (char == ' '):
32
        Stop()
33
    if (char == 'm'):
34
        Distancia()
35
    if (char == 'l'):
36
        StopCannon()
37
    
38