Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Z
zeromq-examples
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kei Tsuji
zeromq-examples
Commits
06b4e37d
Commit
06b4e37d
authored
Feb 14, 2023
by
Kei Tsuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Pipfile and pub-sub examples
parents
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
0 deletions
+43
-0
Pipfile
Pipfile
+13
-0
publisher.py
pub-sub/publisher.py
+15
-0
subscriber.py
pub-sub/subscriber.py
+15
-0
No files found.
Pipfile
0 → 100644
View file @
06b4e37d
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
pyzmq = "*"
[dev-packages]
[requires]
python_version = "3.8"
python_full_version = "3.8.12"
pub-sub/publisher.py
0 → 100644
View file @
06b4e37d
import
signal
import
time
import
zmq
signal
.
signal
(
signal
.
SIGINT
,
signal
.
SIG_DFL
)
context
=
zmq
.
Context
()
socket
=
context
.
socket
(
zmq
.
PUB
)
socket
.
bind
(
'tcp://*:5555'
)
for
i
in
range
(
5
):
socket
.
send
(
b
'status 5'
)
socket
.
send
(
b
'All is well'
)
time
.
sleep
(
1
)
pub-sub/subscriber.py
0 → 100644
View file @
06b4e37d
import
signal
import
zmq
signal
.
signal
(
signal
.
SIGINT
,
signal
.
SIG_DFL
)
context
=
zmq
.
Context
()
socket
=
context
.
socket
(
zmq
.
SUB
)
socket
.
connect
(
'tcp://localhost:5555'
)
socket
.
setsockopt
(
zmq
.
SUBSCRIBE
,
b
'status'
)
while
True
:
message
=
socket
.
recv_multipart
()
print
(
f
'Received: {message}'
)
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