Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-Erm
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
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-Erm
Commits
61181bb8
Commit
61181bb8
authored
Apr 12, 2021
by
Suzhi Bi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
decc4a55
Pipeline
#64
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
server_code/result_return.py
server_code/result_return.py
+32
-0
No files found.
server_code/result_return.py
0 → 100644
View file @
61181bb8
import
socket
import
os
import
sys
import
struct
addr
=
sys
.
argv
[
1
]
img_name
=
sys
.
argv
[
2
]
try
:
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
.
connect
(
(
str
(
addr
),
8085
)
)
except
socket
.
error
as
msg
:
print
(
msg
)
sys
.
exit
(
1
)
while
1
:
filepath
=
"result_"
+
str
(
addr
)
+
"_"
+
str
(
img_name
)
print
(
filepath
)
if
os
.
path
.
isfile
(
filepath
):
fileinfo_size
=
struct
.
calcsize
(
'128sq'
)
fhead
=
struct
.
pack
(
'128sq'
,
bytes
(
os
.
path
.
basename
(
filepath
).
encode
(
'utf-8'
)),
os
.
stat
(
filepath
).
st_size
)
s
.
send
(
fhead
)
print
(
'client filepath: {0}'
.
format
(
filepath
))
fp
=
open
(
filepath
,
'rb'
)
while
1
:
data
=
fp
.
read
(
1024
)
if
not
data
:
print
(
'{0} file send over...'
.
format
(
filepath
))
break
s
.
send
(
data
)
s
.
close
()
break
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