Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rdos-python
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Julien David
rdos-python
Commits
0b97f07d
Commit
0b97f07d
authored
4 years ago
by
david
Browse files
Options
Downloads
Patches
Plain Diff
modified ci and flake8 added
parent
9e6bbcd4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#626
failed with stage
in 12 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+4
-1
4 additions, 1 deletion
.gitlab-ci.yml
client.py
+25
-21
25 additions, 21 deletions
client.py
with
29 additions
and
22 deletions
.gitlab-ci.yml
+
4
−
1
View file @
0b97f07d
...
...
@@ -7,14 +7,17 @@ stages:
job:test:unit
:
before_script
:
-
echo "Install Dependancies"
-
sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
-
apk update
-
apk add python3
-
apk add py-pip
-
pip install pytest mysql-connector-python get_docker_secret docker
-
pip install pytest mysql-connector-python get_docker_secret docker
flake8
-
echo "Start Tests"
script
:
-
cd tests
-
pytest -v
-
cd ..
-
flake8 --max-line-length=120 softwares/server/*
after_script
:
-
echo "Tests have been done"
This diff is collapsed.
Click to expand it.
client.py
+
25
−
21
View file @
0b97f07d
# Authors : Julien DAVID & Ismail MOUMNI
# Authors : Julien DAVID & Ismail MOUMNI
import
socket
__RDOS_Port__
=
9393
__RDOS_Host__
=
'
127.0.0.1
'
# Function server_conn creates a socket and connects it to server
# Function server_conn take No arguments
# Function returns a socket after making connexion
def
server_conn
(
host
,
port
):
__RDOS_Port__
=
9393
__RDOS_Host__
=
'
127.0.0.1
'
# Function server_conn creates a socket and connects it to server
# Function server_conn take No arguments
# Function returns a socket after making connexion
def
server_conn
(
host
,
port
):
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
.
connect
((
host
,
port
))
s
.
connect
((
host
,
port
))
return
s
# send_mess Function that return a message from a server to a client connexion
# Send_mess Function that return a message from a server to a client connexion
# Function takes 2 parameters (Socket & Message )
# Function Output message send from server
def
send_message
(
conn
:
socket
,
message
:
str
):
data
=
""
if
len
(
message
)
!=
0
:
conn
.
send
(
bytes
(
message
,
"
utf-8
"
))
if
len
(
message
)
!=
0
:
conn
.
send
(
bytes
(
message
,
"
utf-8
"
))
data
=
conn
.
recv
(
1024
)
return
data
return
data
# Function run_client connects client to server by socket
# Function run_client takes 3 parameters -Host : IP ADDRESS OF SERVER -Port : Server PORT -MESS:Message sent to the server
# Function run_Client returns the state of the server
def
run_client
(
Host
,
Port
,
message
:
str
):
s
=
server_conn
(
Host
,
Port
)
print
(
"
Starting connexion to server on Port :
"
,
Port
)
recv
=
send_message
(
s
,
message
)
print
(
"
Message ENVOYÉ :
"
,
recv
)
# Function run_client connects client to server by socket
# Function run_client takes 3 parameters - Host : IP ADDRESS OF SERVER
# - Port : Server PORT
# - MESS : Message sent to the server
# Function run_Client returns the state of the server
def
run_client
(
Host
,
Port
,
message
:
str
):
s
=
server_conn
(
Host
,
Port
)
print
(
"
Starting connexion to server on Port :
"
,
Port
)
recv
=
send_message
(
s
,
message
)
print
(
"
Message ENVOYÉ :
"
,
recv
)
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