Commit a530adb2e777ae4e77e8442823d55f43606876ca

Authored by Mestari Yousra
1 parent 66b82a3f

algo du serveur

Showing 1 changed file with 48 additions and 0 deletions   Show diff stats
serveur.py 0 → 100644
... ... @@ -0,0 +1,48 @@
  1 +import zmq
  2 +
  3 +context = zmq.Context()
  4 +
  5 +# Socket to talk to server
  6 +print("Connecting to hello world server…")
  7 +socket = context.socket(zmq.DEALER)
  8 +socket.connect("tcp://147.250.9.87:5555")
  9 +
  10 +# Do 10 requests, waiting each time for a response
  11 +while True :
  12 + jeu=input("Voulez-vous jouer ?:")
  13 + if jeu=="PLAY":
  14 + socket.send_multipart([b'',b"PLAY"])
  15 + empty,reponse=socket.recv_multipart()
  16 + print(reponse.decode())
  17 + JouC=input()
  18 + socket.send_multipart([b'',JouC.encode()])
  19 + empty,reponse=socket.recv_multipart()
  20 + print(reponse.decode())
  21 + nom=input()
  22 + socket.send_multipart([b'',nom.encode()])
  23 + for i in range(5):
  24 + empty,reponse=socket.recv_multipart()
  25 + print(reponse.decode())
  26 + position_avant=input()
  27 + socket.send_multipart([b'',position_avant.encode()])
  28 + empty,reponse=socket.recv_multipart()
  29 + print(reponse.decode())
  30 + position_queue=input()
  31 + socket.send_multipart([b'',position_queue.encode()])
  32 + empty,reponse=socket.recv_multipart()
  33 + print(reponse.decode())
  34 + case=input()
  35 + socket.send_multipart([b'',case.encode()])
  36 + empty,reponse=socket.recv_multipart()
  37 + reponse=reponse.decode()
  38 + print(reponse)
  39 + while reponse=="Touche! Quelle case frapper?":
  40 + case=input()
  41 + socket.send_multipart([b'',case.encode()])
  42 + empty,reponse=socket.recv_multipart()
  43 + print(reponse.decode())
  44 + empty,reponse=socket.recv_multipart()
  45 + print(reponse.decode())
  46 +
  47 + # Get the reply.
  48 + #message = socket.recv()
0 49 \ No newline at end of file
... ...