Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CSCI70-sockets
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Emanuel Czar Reyes
CSCI70-sockets
Commits
057f43dc
Commit
057f43dc
authored
Nov 06, 2022
by
Emanuel Czar Reyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initialized with client and server
parents
Pipeline
#2548
failed with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
client.py
client.py
+11
-0
server.py
server.py
+21
-0
No files found.
client.py
0 → 100644
View file @
057f43dc
import
socket
conn
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
conn
.
connect
((
"192.168.1.2"
,
5050
))
#change to your ipv4 wifi address
#copied from sample
conn
.
sendall
(
b
"has connected"
)
data
=
conn
.
recv
(
1024
)
print
(
f
"Received {data!r}"
)
\ No newline at end of file
server.py
0 → 100644
View file @
057f43dc
import
socket
HOST
=
"192.168.1.2"
#change to your ipv4 wifi address
PORT
=
5050
server
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
server
.
bind
((
HOST
,
PORT
))
server
.
listen
(
1
)
conn
,
addr
=
server
.
accept
()
#handle_game --function to handle game
#copied from sample
with
conn
:
print
(
f
"Connected by {addr}"
)
while
True
:
data
=
conn
.
recv
(
1024
)
print
(
data
)
if
not
data
:
break
conn
.
sendall
(
data
)
\ 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