Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SSE-IoT-Encryption
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
Dominik Fuhrmann
SSE-IoT-Encryption
Commits
63811a6d
Commit
63811a6d
authored
5 months ago
by
Dominik Fuhrmann
Browse files
Options
Downloads
Patches
Plain Diff
mnore logs
parent
ee6f3e4f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
communicationScripts/client.py
+8
-3
8 additions, 3 deletions
communicationScripts/client.py
with
8 additions
and
3 deletions
communicationScripts/client.py
+
8
−
3
View file @
63811a6d
...
@@ -12,16 +12,21 @@ def run_client(file_path):
...
@@ -12,16 +12,21 @@ def run_client(file_path):
# Sichere Verbindung mit dem Server herstellen
# Sichere Verbindung mit dem Server herstellen
try
:
try
:
print
(
"
Versuche, Verbindung zum Server herzustellen...
"
)
with
socket
.
create_connection
((
"
192.168.125.101
"
,
5000
))
as
sock
:
with
socket
.
create_connection
((
"
192.168.125.101
"
,
5000
))
as
sock
:
print
(
"
Verbindung zum Server
wird
hergestellt.
..
"
)
print
(
"
Verbindung zum Server
erfolgreich
hergestellt.
"
)
with
context
.
wrap_socket
(
sock
,
server_hostname
=
"
192.168.125.101
"
)
as
ssl_sock
:
with
context
.
wrap_socket
(
sock
,
server_hostname
=
"
192.168.125.101
"
)
as
ssl_sock
:
print
(
"
Mit dem Server verbunden!
"
)
print
(
"
Mit dem Server verbunden
und SSL-Handschlag abgeschlossen
!
"
)
# Datei senden
# Datei senden
print
(
f
"
Beginne mit dem Senden der Datei
'
{
file_path
}
'
...
"
)
with
open
(
file_path
,
"
rb
"
)
as
f
:
with
open
(
file_path
,
"
rb
"
)
as
f
:
total_bytes_sent
=
0
while
chunk
:
=
f
.
read
(
1024
):
while
chunk
:
=
f
.
read
(
1024
):
ssl_sock
.
sendall
(
chunk
)
ssl_sock
.
sendall
(
chunk
)
print
(
f
"
Datei
'
{
file_path
}
'
erfolgreich an den Server gesendet.
"
)
total_bytes_sent
+=
len
(
chunk
)
print
(
f
"
Datei
'
{
file_path
}
'
erfolgreich an den Server gesendet. (
{
total_bytes_sent
}
Bytes)
"
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
f
"
Fehler bei der Verbindung zum Server:
{
e
}
"
)
print
(
f
"
Fehler bei der Verbindung zum Server:
{
e
}
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment