Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-cloning
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yogesh.m
opcua-cloning
Commits
92f2c104
Commit
92f2c104
authored
Mar 16, 2023
by
yogesh.m
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update removing pickle
parent
11d28112
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
7 deletions
+13
-7
.idea/misc.xml
.idea/misc.xml
+1
-1
.idea/opcua-cloning.iml
.idea/opcua-cloning.iml
+1
-1
asyncua_server.py
asyncua_server.py
+4
-2
hash_sender.py
hash_sender.py
+7
-3
No files found.
.idea/misc.xml
View file @
92f2c104
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.9
(pythonProject)
"
project-jdk-type=
"Python SDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.9"
project-jdk-type=
"Python SDK"
/>
</project>
\ No newline at end of file
.idea/opcua-cloning.iml
View file @
92f2c104
...
...
@@ -2,7 +2,7 @@
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.9
(pythonProject)
"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.9"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</module>
\ No newline at end of file
asyncua_server.py
View file @
92f2c104
...
...
@@ -4,6 +4,7 @@ from asyncua import ua, Server
import
socket
import
threading
import
json
import
struct
server_up
=
False
...
...
@@ -188,8 +189,9 @@ def hash_receive(udp_receiver_ip,udp_receiver_port):
while
(
True
):
bytesAddressPair
=
UDPServerSocket
.
recvfrom
(
bufferSize
)
message
=
bytesAddressPair
[
0
]
hierarchy
=
pickle
.
loads
(
message
)
hierarchy
=
json
.
loads
(
hierarchy
)
string_length
=
struct
.
unpack
(
"!I"
,
message
[:
4
])[
0
]
json_string
=
message
[
4
:]
.
decode
(
'utf-8'
)
hierarchy
=
json
.
loads
(
json_string
)
if
(
prev_hash
!=
hierarchy
[
"hash"
]
and
asr
.
idx
):
analyse_hierarchy
(
hierarchy
)
prev_hash
=
hierarchy
[
"hash"
]
...
...
hash_sender.py
View file @
92f2c104
...
...
@@ -2,7 +2,7 @@ from asyncua import Client
import
asyncio
import
socket
from
time
import
sleep
import
pickle
import
struct
import
json
nm_no
=
None
...
...
@@ -50,8 +50,12 @@ async def get_send_hash(ENDPOINT,NAMESPACE,server_hash_udp_ip,server_hash_udp_po
node_hierarchy
[
"hash"
]
=
hash
(
str
(
node_hierarchy
))
node_hierarchy
[
"namespace_idx"
]
=
nm_no
json_hierarchy
=
json
.
dumps
(
node_hierarchy
)
hierarchy
=
pickle
.
dumps
(
json_hierarchy
)
UDPClientSocket
.
sendto
(
hierarchy
,
serverAddressPort
)
hierarchy
=
json
.
dumps
(
json_hierarchy
)
utf8_encoded_string
=
hierarchy
.
encode
(
'utf-8'
)
string_length
=
len
(
utf8_encoded_string
)
length_bytes
=
struct
.
pack
(
"!I"
,
string_length
)
binary_data
=
length_bytes
+
utf8_encoded_string
UDPClientSocket
.
sendto
(
binary_data
,
serverAddressPort
)
def
send_hash
(
Endpoint
,
Namespace
,
server_hash_udp_ip
,
server_hash_udp_port
):
asyncio
.
run
(
get_send_hash
(
Endpoint
,
Namespace
,
server_hash_udp_ip
,
server_hash_udp_port
))
\ 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