Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mestari Yousra
NOTRE_PROJEEET
Commits
a530adb2
Commit
a530adb2
authored
May 28, 2017
by
Mestari Yousra
Browse files
algo du serveur
parent
66b82a3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
serveur.py
0 → 100644
View file @
a530adb2
import
zmq
context
=
zmq
.
Context
()
# Socket to talk to server
print
(
"Connecting to hello world server…"
)
socket
=
context
.
socket
(
zmq
.
DEALER
)
socket
.
connect
(
"tcp://147.250.9.87:5555"
)
# Do 10 requests, waiting each time for a response
while
True
:
jeu
=
input
(
"Voulez-vous jouer ?:"
)
if
jeu
==
"PLAY"
:
socket
.
send_multipart
([
b
''
,
b
"PLAY"
])
empty
,
reponse
=
socket
.
recv_multipart
()
print
(
reponse
.
decode
())
JouC
=
input
()
socket
.
send_multipart
([
b
''
,
JouC
.
encode
()])
empty
,
reponse
=
socket
.
recv_multipart
()
print
(
reponse
.
decode
())
nom
=
input
()
socket
.
send_multipart
([
b
''
,
nom
.
encode
()])
for
i
in
range
(
5
):
empty
,
reponse
=
socket
.
recv_multipart
()
print
(
reponse
.
decode
())
position_avant
=
input
()
socket
.
send_multipart
([
b
''
,
position_avant
.
encode
()])
empty
,
reponse
=
socket
.
recv_multipart
()
print
(
reponse
.
decode
())
position_queue
=
input
()
socket
.
send_multipart
([
b
''
,
position_queue
.
encode
()])
empty
,
reponse
=
socket
.
recv_multipart
()
print
(
reponse
.
decode
())
case
=
input
()
socket
.
send_multipart
([
b
''
,
case
.
encode
()])
empty
,
reponse
=
socket
.
recv_multipart
()
reponse
=
reponse
.
decode
()
print
(
reponse
)
while
reponse
==
"Touche! Quelle case frapper?"
:
case
=
input
()
socket
.
send_multipart
([
b
''
,
case
.
encode
()])
empty
,
reponse
=
socket
.
recv_multipart
()
print
(
reponse
.
decode
())
empty
,
reponse
=
socket
.
recv_multipart
()
print
(
reponse
.
decode
())
# Get the reply.
#message = socket.recv()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment