Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
2a097dfa
Commit
2a097dfa
authored
Feb 15, 2018
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples: import client/server.py test scripts as examples
parent
ac4a42a4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
examples/service/client.py
examples/service/client.py
+17
-0
examples/service/server.py
examples/service/server.py
+25
-0
No files found.
examples/service/client.py
0 → 100644
View file @
2a097dfa
import
socket
import
mitogen.master
import
mitogen.unix
import
mitogen.service
import
mitogen.utils
PING
=
500
mitogen
.
utils
.
log_to_file
()
router
,
parent
=
mitogen
.
unix
.
connect
(
'/tmp/mitosock'
)
with
router
:
print
mitogen
.
service
.
call
(
parent
,
CONNECT_BY_ID
,
{})
examples/service/server.py
0 → 100644
View file @
2a097dfa
# The service framework will fundamentally change (i.e. become much nicer, and
# hopefully lose those hard-coded magic numbers somehow), but meanwhile this is
# a taster of how it looks today.
import
time
import
mitogen
import
mitogen.service
import
mitogen.unix
class
PingService
(
mitogen
.
service
.
Service
):
well_known_id
=
500
max_message_size
=
1000
def
dispatch
(
self
,
dct
,
msg
):
return
'Hello, world'
@
mitogen
.
main
()
def
main
(
router
):
listener
=
mitogen
.
unix
.
Listener
(
router
,
path
=
'/tmp/mitosock'
)
service
=
PingService
(
router
)
service
.
run
()
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