Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python-cellframe
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
python-cellframe
Merge requests
!85
Hotfix-5636
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Hotfix-5636
bugs-5636
into
master
Overview
0
Commits
20
Pipelines
0
Changes
21
Merged
alexey.stratulat
requested to merge
bugs-5636
into
master
3 years ago
Overview
0
Commits
20
Pipelines
0
Changes
1
Expand
Updated cellframe-sdk and fixed errors compilation python-cellframe.
👍
0
👎
0
Merge request reports
Viewing commit
2e478360
Prev
Next
Show latest version
1 file
+
15
−
8
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
2e478360
[*] Service client example
· 2e478360
Roman Khlopkov
authored
3 years ago
dists/examples/plugins/demoNodeClient/demoNodeClient.py
+
15
−
8
Options
from
API_CellFrame
import
ChainNetSrvClient
,
logItNotice
,
logItInfo
,
ChainNet
,
ChainNetSrv
,
ChainNetSrvUID
def
handler
(
nodeClient
,
type
):
print
(
type
)
print
(
"
HANDLER OK
"
)
if
type
==
0
:
ch_uid
=
ChainNetSrvUID
(
156
)
nodeClient
.
write
(
1
,
301
,
ch_uid
,
"
HELLO I TEST SERV
"
.
encode
(
'
utf-8
'
))
def
callback_connected
(
serviceClient
,
arg
):
print
(
"
Python client connected
"
)
ch_uid
=
ChainNetSrvUID
(
156
)
serviceClient
.
write
(
1
,
301
,
ch_uid
,
"
HELLO I TEST SERV
"
.
encode
(
'
utf-8
'
))
def
callback_read
(
serviceClient
,
data
):
print
(
"
Python client read back
\'
{:s}
\'
"
.
format
(
data
))
def
callback_disconnected
(
serviceClient
,
arg
):
print
(
"
Python client disconnected
"
)
def
callback_deleted
(
serviceClient
,
arg
):
print
(
"
Python client deleted
"
)
#def clientCMD(argv, indexStrReply):
# reply = "Connected to ..."
@@ -18,8 +25,8 @@ def init():
# Command for working cmd client
#"""
#)
net
=
ChainNet
.
byName
(
"
kelvin-testnet
"
)
client
=
ChainNetSrvClient
(
net
,
"
1
27.0.0
.1
"
,
8079
,
handler
)
net
=
ChainNet
.
byName
(
"
subzero
"
)
client
=
ChainNetSrvClient
(
net
,
"
1
92.168.1
.1
0
"
,
8079
,
callback_connected
,
callback_read
,
callback_disconnected
,
callback_deleted
,
net
)
# client.test()
# ch_uid = ChainNetSrvUID(156)
# ch_uid2 = ChainNetSrvUID.fromStr("0x1101")
Loading