Created
January 13, 2015 08:18
-
-
Save mehdisadeghi/252895d8264cf36c5743 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Request-reply client in Python | |
# Connects REQ socket to tcp://localhost:5559 | |
# Sends "Hello" to server, expects "World" back | |
# | |
import zmq | |
import sys | |
# Prepare our context and sockets | |
context = zmq.Context() | |
socket = context.socket(zmq.REQ) | |
socket.connect("tcp://localhost:40002") | |
# Get request | |
socket.send(b"get:", zmq.SNDMORE) | |
socket.send(b"the key") | |
print socket.recv() | |
# and for set | |
# Set request | |
#socket.send(b"set:", zmq.SNDMORE) | |
#socket.send(b"the key", zmq.SNDMORE) | |
#socket.send(value) | |
#print socket.recv() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment