Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
csci363
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Projects
csci363
Commits
94caafce
Commit
94caafce
authored
Apr 04, 2019
by
Alan Marchiori
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proj1 feedback
parent
d2b8d806
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
proj1_rdt/feedback.txt
proj1_rdt/feedback.txt
+2
-0
proj1_rdt/recv.py
proj1_rdt/recv.py
+2
-2
proj1_rdt/sender.py
proj1_rdt/sender.py
+4
-1
No files found.
proj1_rdt/feedback.txt
0 → 100644
View file @
94caafce
4/4/19 - AMM
This is a stop and wait protocol with a sequence number and base64 copies of the data as a checksum. This will work fine with text data but won't work for binary files. The implementation is fairly clean and intuitive.
proj1_rdt/recv.py
View file @
94caafce
...
...
@@ -82,7 +82,7 @@ startTime = datetime.now()
print
(
'established connection with server, waiting to receive...'
)
while
True
:
data
,
addr
=
sock
.
recvfrom
(
1048
)
data
,
addr
=
sock
.
recvfrom
(
1048
)
# why 1048? what if a line is longer than 1048 bytes?
#print("recv data: {}".format(data))
while
data
!=
b
'####'
and
data
!=
b
'END'
:
...
...
@@ -93,7 +93,7 @@ while True:
sock
.
sendto
(
b
'NNNN'
,
addr
)
# print(get_decode_list(lineStr))
data
,
addr
=
sock
.
recvfrom
(
1048
)
if
data
==
b
'####'
:
#print('Got line end!')
packetList
=
get_decode_list
(
lineStr
)
...
...
proj1_rdt/sender.py
View file @
94caafce
...
...
@@ -49,7 +49,7 @@ def build_packet(index, line):
def
rdt_sendFile
(
network
,
dest
,
filename
,
size
=
65536
):
# generate lines from file
file
=
open
(
filename
)
lines
=
file
.
readlines
()
lines
=
file
.
readlines
()
#will this work with binary files?
line_count
=
len
(
lines
)
currentIndex
=
0
while
currentIndex
<
line_count
:
...
...
@@ -76,6 +76,9 @@ def rdt_sendFile(network, dest, filename, size=65536):
#current_line = build_packet(currentIndex, lines[currentIndex])
print
(
'resending packet {},{}'
.
format
(
currentIndex
,
lines
[
currentIndex
]))
send_line
(
network
,
dest
,
hashed_line
,
size
)
except
KeyboardInterrupt
:
print
(
'Ctrl-c, goodbye!'
)
exit
()
except
socket
.
timeout
:
print
(
'timeout!'
)
except
:
...
...
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