首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
代写program编程、代做Python编程设计
项目预算:
开发周期:
发布时间:
要求地区:
Project 3: TCP Implementation
Introduction
TCP serves many purposes: it provides reliable, in-order delivery of bytes, it makes
sure the sender does not send too fast and overwhelm the receiver (flow control), and
it makes sure the sender does not send too fast and overwhelm the network
(congestion control). It also aims to be fair: when multiple senders share the same
link, they should receive roughly the same proportion of bandwidth. In this project,
you will demonstrate your understanding of the TCP basics by implementing the TCP
protocol.
Be prepared: this is a single-person project, and your skills will be exercised. So start
early and feel more than welcome to ask questions. However, please note that the TAs
are not allowed to debug your code for you during their office hours. They cannot
touch your keyboard, and they will only spend a maximum of 10 minutes reading
your code. This helps them to assist more students effectively. Therefore, it is
recommended that you visit their office hours with specific questions instead of vague
statements like "my code doesn’t work." For debugging, logging or tools like
Wireshark1
can be helpful. There are many ways to do this; be creative.
TCP Recap
TCP is a transport layer protocol that enables different devices to communicate. As a
reminder the basic setup is the following.
You have an initiator (client) and a listener (server). The listener is waiting to receive
a connection from the initiator. After a connection is received, they perform a TCP
handshake to initiate the connection. Afterward, they can read and write to each other.
From the application layer, reads and writes to the socket are buffered before being
sent over the network. This means that multiple reads or writes might be combined
into a single packet or the opposite, that a single read or write to a socket might be
split into many packets.
To establish reliable data transfer, TCP must manage many different variables and
data structures. Here are some examples of the details you’ll need to track.
1 https://www.wireshark.org/
Let’s say we have sockets A and B, and that socket A wants to start sending data to
socket B. A will store the data in a buffer that it will pull from for sending packets.
Socket A will then create packets using data from the buffer and send as many as it is
allowed to send based on the congestion control algorithm used. As Socket B receives
packets, it stores the data transmitted in a buffer. This buffer helps with maintaining
the principle of in-order data transmission. B sends ACKs as responses to A to notify
A that various bytes have been received up to a certain point. B is also tracking the
next byte requested by the application reading from the socket, and when it receives
this byte, it will forward as much data in order that it can to the application buffer. For
example, if B is looking for byte number 400, it will not write any other bytes into the
application’s buffer until it receives byte number 400. After receiving byte number
400, it will write in as many other bytes as it can. (If B had bytes 400-1000 then all
would be written to the application buffer at the time of receiving the packet with byte
400. As packets are ACK’d, socket A will release memory used for storing data as
they no longer need to hold onto it. Finally, either side can initiate closing the
connection where the close handshake begins.
As both sides (initiator and listener) can both send and receive, you’ll be tracking a lot
of data and information. It’s important to write down everything each side knows
while writing your implementation and to utilize interfaces to keep your code module
and re-usable.
Project Specification
You are implementing the interfaces in tcpSock.py, such as case_socket and
case_close. Your code will be tested by us creating other Python files that will
utilize your interface to perform communications. The starter code has an example of
how we might perform the tests, we have a client.py and server.py which utilize the
sockets to send information back and forth. You can add additional helper functions to
tcpSock or change the implementation of the 4 core functions (socket, close,
read, and write). However, you cannot change the function signature of the 4 core
functions. Further, we will be utilizing grading.py to help us test your code. We may
change any of the values for the variables present in the file to make sure you aren’t
hard-coding anything. Namely, we will be varying the packet length and the initial
window variables.
Starter Code
The following files have been provided for you to use:
• packet.py: this file describes the basic packet format and header. You are not
allowed to modify this file.
• grading.py: these are variables that we will use to test your implementation;
please do not make any changes here, as we will replace them when running
tests.
• server.py: this is the starter code for the server side of your transport
protocol.
• client.py: this is the starter code for the client side of your transport
protocol.
• tcpSock.py: this contains the main socket functions required of your TCP
socket, including reading, writing, opening, and closing.
• backend.py: this file contains the code used to emulate the buffering and
sending of packets. This is where you should spend most of your time.
All the communication between your server and the client will use UDP as the
underlying protocol. All packets will begin with the common header described in
packet.py as follows:
− Identifier [4 bytes]
− Source Port [2 bytes]
− Destination Port [2 bytes]
− Sequence Number [4 bytes]
− Acknowledgement Number [4 bytes]
− Header Length [2 bytes]
− Packet Length [2 bytes]
− Flags [1 byte]
− Advertised Window [2 bytes]
All multi-byte integer fields must be transmitted in network byte order.
socket.ntoh and socket.hton and other related functions will be very
important for you to call. All integers must be unsigned, and the identifier should
be set to 3425. You are not allowed to change any of the fields in the header.
Additionally, packet length cannot exceed 1400 in order to prevent packets from
being broken into parts.
You can verify that your headers are sent correctly using wireshark or tcpdump.
You can view packet data sent including the full Ethernet frames. When viewing
your packet, you should see something similar to the below image; in this case, the
payload starts at 0x0035. The identifier - 3425 - shows up in hex as 0x0d61.
Implementation Tasks
1. TCP Handshakes - Implement TCP start and end handshakes before data
transmission starts and ends [1]. This should happen in the constructor and
destructor for case tcp socket.
2. Flow Control - You will notice that data transfer is very slow. That is because
the starter code is using the Stop-and-Wait algorithm, transmitting one packet
at a time. You can do much better by using a window of outstanding packets to
send on the network. Extend the implementation to: 1) Change the sequence
numbers and ACK numbers to represent the number of bytes sent and received
(rather than segments) 2) Implement TCP’s sliding window algorithm to send a
window of packets and utilize the advertised window to limit the amount of
data sent by the sender [2].
3. RTT Estimation - You will notice that loss recovery is very slow! One reason
for this is the starter code uses a fixed retransmission timeout (RTO) of 3
seconds. Implement an adaptive RTO by estimating the RTT [3].
4. Duplicate ACK Retransmission - another reason loss recovery is slow is that
the starter code relies on timeouts to detect packet loss. One way to recover
more quickly is to retransmit whenever you see triple duplicate ACKs.
Implement retransmission upon receipt of three duplicate ACKs.
For 325 students, you only need to implement Tasks 1 and 2; you will get extra
credits for implementing all 4 tasks. For 425 students, you will need to implement
all of them.
References
[1] TCP connection establishment and termination:
https://book.systemsapproach.org/e2e/tcp.html#connection-establishment-and-termination
[2] TCP sliding window:
https://book.systemsapproach.org/direct/reliable.html#sliding-window
https://book.systemsapproach.org/e2e/tcp.html#sliding-window-revisited
[3] Adaptive retransmission:
https://book.systemsapproach.org/e2e/tcp.html#adaptive-retransmission
Useful Links
Programming in Python
The 8th edition of the textbook (and what we’ve discussed in class) uses sockets in Python. A
Python socket tutorial is http://docs.python.org/howto/sockets.html
It may also help by reading the system implementation of epoll at
https://codebrowser.dev/glibc/glibc/sysdeps/unix/sysv/linux/sys/epoll.h.html. You
will better understand the epoll events.
REMINDERS
o Submit your code to Canvas in a zip file
o If your code does not run, you will not get credits.
o Document your code (by inserting comments in your code)
o DUE: 11:59 pm, Friday, April 26th
.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写dts207tc、sql编程语言代做
2024-12-25
cs209a代做、java程序设计代写
2024-12-25
cs305程序代做、代写python程序...
2024-12-25
代写csc1001、代做python设计程...
2024-12-24
代写practice test preparatio...
2024-12-24
代写bre2031 – environmental...
2024-12-24
代写ece5550: applied kalman ...
2024-12-24
代做conmgnt 7049 – measurem...
2024-12-24
代写ece3700j introduction to...
2024-12-24
代做adad9311 designing the e...
2024-12-24
代做comp5618 - applied cyber...
2024-12-24
代做ece5550: applied kalman ...
2024-12-24
代做cp1402 assignment - netw...
2024-12-24
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!