首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
代做IK2215、代写java设计编程
项目预算:
开发周期:
发布时间:
要求地区:
IK2215 Programming Assignment Introduction
Programming assignment overview
2023-09-07 2
• Design and implement a reliable protocol for sending/receiving datagrams
• Guaranteed UDP (GUDP)
‒ Enabling reliable transport over UDP
‒ Automatic repeat request (ARQ)
˃ uses acknowledgements and timeouts
for reliable transmission
‒ Sliding window flow control
˃ multiple packets in flight
‒ Asynchronous communication
˃ Unlike TCP, GUDP is not connection-oriented
(no connection establishment)
GUDP
Application
UDP
IP Network
Transport
Application
Sliding window flow control
2023-09-07 3
Sender Receiver
ACK4
P0
Window (size 3)
0 1 2 3 4 5 6 7
P1
P2
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7 P3
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
ACK2
ACK3
Go-Back-N Sliding Window Protocol
2023-09-07 4
• Understand the details of a basic, sliding window protocol
• An ACK is an ACK (and not a NACK)
‒ The receiver sends an ACK only if it receives the next packet in sequence*
‒ You cannot use an ACK to tell the sender that a packet has been lost
‒ No duplicate ACK detection
• The sender increases the window in accordance with the ACK
• Retransmissions are triggered by timeouts (and nothing else)
‒ Receiving an ACK with unexpected sequence number does not trigger a
retransmission
* There is an exception case, which we will discuss in the next slide
2023-09-07 5
• The receiver sends an ACK only if it
receives the next packet in sequence
• A deadlock occurs when all ACKs
(= number of window size) were lost
To resolve this problem:
• Receiver must send ACK with the expected
sequence number when it receives a
packet with a lower sequence number than
the expected sequence number
• Sender upon receiving an ACK can
assume all packets with (ACK sequence
number - 1) were received successfully
Exception case
Sender Receiver
Timeout!
Send deadlock!
Window (size 3)
GUDP implementation in java
2023-09-07 6
• GUDP runs in user space, in the same process as the application
We provide:
• GUDPPacket.java: A class for GUDP protocol declarations with
associated methods to access the GUDP packet header and payload
• GUDPSocketAPI.java: Well-defined API (Application Programming
Interface) that you must use for your implementation
• GUDPEndPoint.java (optional): A class for keeping track of an end point
Your main task is to implement GUDP as a java class: GUDPSocket.java
UDP Application UDP GUDP Application
• Sliding window flow control
• ARQ
You are not allowed to modified these files!
GUDP header
2023-09-07 7
• Version: version of the RUDP protocol
‒ We use version 1!
• Type: packet type
‒ BSN, DATA, ACK, and FIN
• How to use sequence numbers:
‒ BSN packets: random
‒ DATA packets: increases by one for each packet sent
‒ ACK packets: sequence number of next expected DATA packet
‒ FIN packets: sequence number of last DATA packet plus one
0 7 8 15 16 32
+--------+--------+--------+--------+
| Version | Type |
+--------+--------+--------+--------+
| Sequence number |
+--------+--------+--------+--------+
GUDPSocketAPI.java – API you must use
2023-09-07 8
• Your code must conform to this API
• Class/method declarations defined for the assignment
• You will write the GUDPSocket class that implements this API
‒ You may add variables, methods, and inner classes in GUDPSocket.java
import java.net.DatagramPacket;
import java.io.IOException;
public interface GUDPSocketAPI {
public void send(DatagramPacket packet) throws IOException;
public void receive(DatagramPacket packet) throws IOException;
public void finish() throws IOException;
public void close() throws IOException;
}
GUDPSocket.java – skeleton code for you
2023-09-07 9
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.io.IOException;
public class GUDPSocket implements GUDPSocketAPI {
DatagramSocket datagramSocket;
public GUDPSocket(DatagramSocket socket) {
datagramSocket = socket;
}
public void send(DatagramPacket packet) throws IOException {
}
public void receive(DatagramPacket packet) throws IOException {
}
public void finish() throws IOException {
}
public void close() throws IOException {
}
}
send()
2023-09-07 10
• Send a packet
• The application put packet in the DatagramPacket format
• The destination address/port included in the packet
• Non-blocking – returns immediately
‒ GDUP queue packet for future delivery
public void send(DatagramPacket packet) throws IOException;
receive()
2023-09-07 11
• Receive a packet
• The application fetch a packet from GUDP if there is one, otherwise wait
until a packet arrives
• The application handles packets from different senders (which can be
differentiated based on the information in the packet)
public void receive(DatagramPacket packet) throws IOException;
finish()
2023-09-07 12
• Finish sending
• The application calls this method to inform GUDP that it’s done sending
• GUDP completes the actual sending and return when it is done, otherwise
report error/timeout by throwing the IOException
‒ Retransmission may occur due to packet lost or arriving out-of-order
‒ You may clean up data structure that you use to track destination end points
public void finish() throws IOException;
close()
2023-09-07 13
• Close the GUDP socket
• The application calls this method to terminate the GUDP socket
• GUDP cleans up, closes the socket, and return.
public void close() throws IOException;
GUDP sender side
2023-09-07 14
• Data transfer may happen after the application passed all packets to GUDP
• GUDP can send multiple packets (<= window size) before it receives any ACK
send(packet)
Application GUDP Network
GUDP ACK
GUDP BSN
GUDP DATA
GUDP DATA
GUDP ACK
send(packet)
finish()
finish() return
GUDP ACK
GUDP receiver side
2023-09-07 15
• Receive returns only after GUDP has DATA
• Receiver may keep socket open to receive more DATA
receive(packet)
Application GUDP Network
GUDP DATA
GUDP ACK
GUDP ACK
receive(packet)
GUDP BSN
GUDP DATA
GUDP ACK
receive(packet) return
receive(packet) return
2023-09-07 16
• An application can open multiple
GUDP sockets
• Each GUDP socket can be used for
communication with multiple peers
• Two levels
‒ Multiple GUDP sockets
‒ Multiple peers per socket
• Need to
‒ Maintain state for per-socket “peers”
‒ Have a way to look up peer state
‒ Maintain queues with outbound
packets
Protocol control block
Program
Application
RUDP
Socket Socket
Peers
Grading overview
2023-09-07 17
The application should be able to:
• Send one or more files to one or more destinations
• Receive multiple files from one or more sources
• Handle unexpected situations gracefully
• Work with other implementations
To pass, you must meet two criteria below:
1. Application must be able to send and receive one file on one destination
‒ GUDP must be used in data transmission (show on the wire correctly)
‒ Sliding window flow control is working correctly (multiple packets in-flight)
‒ ARQ mechanism is working correctly (handle packet loss correctly)
2. And score at least 3 out of 6 points
• Deadline: Tue 3 Oct at 17:00 • Make-up deadline: Wed 11 Oct at 17:00
Plagiarism*
2023-09-07 18
Plagiarism in practical work and computing code
“It is important that students ‘do their own work’ when they write computer
code, when document an experiment, create a design or answer a
mathematical problem. If they do not do these activities themselves, yet
claim the results as their own, this is plagiarism.”
• Students who, with unauthorized aids or otherwise attempt to mislead the
exam or when a student's performance is otherwise to be assessed, may
lead to disciplinary action.
* More information on KTH webpage about Cheating and plagiarism
Grading test cases
2023-09-07 19
1. Multiple packets in-flight (0.5p)
2. Send and receive files with your code without loss (0.5p)
3. Send one file to other receiver without loss (0.5p)
4. Send one file to other receiver with loss (0.5p)
5. Receive one file from other sender without loss (0.5p)
6. Receive one file from other sender with loss (0.5p)
7. Send one file to multiple receivers without loss (0.5p)
8. Send one file to multiple receivers with loss (0.5p)
9. Send multiple files to other receiver without loss (0.5p)
10. Send multiple files to other receiver with loss (0.5p)
11. Receive multiple files from other sender without loss (0.5p)
12. Receive multiple files from other sender with loss (0.5p)
>=2.5 points
>=3 points
Testing
2023-09-07 20
• We provide sample applications that you can use to test your GUDP code
‒ VSFtp.java: A class for a simple file transfer protocol
‒ VSSend.java: An application for sending files over VSFtp
‒ VSRecv.java: An application for receiving files over VSFtp
• You are responsible for identifying relevant test cases and performing tests
• Think through the protocol carefully and know how it should work exactly
• Think through the dynamic behaviour of the GUDP library
‒ What happens, and when?
• Define the protocol states and transitions
‒
• If you have question:
‒ Discussion forum: Q&A for lab activities
‒ Q&A sessions for verbal discussion or additional support
Test service – http://ik2215.ssvl.kth.se
2023-09-07 21
• You must provide:
‒ Your KTH account i.e., KTH email without the “KTH@SE” part
‒ Your GUDPSocket.java file
• The test runs at 00:00 everyday
‒ Slow: > 5 minutes per submission
• Results send to provided KTH account
2023-09-07 22
### TEST6: receive one file from other sender with loss (0.5p)
OK: Your code can receive one file when first BSN is lost
OK: Your code can receive one file when first DATA is lost
OK: Your code can receive one file when first FIN is lost
OK: Your code can receive one file when first ACK is lost
OK: Your code can receive one file with random loss
TEST6: OK 0.5p
### TEST7: send one file to multiple receivers without loss (0.5p)
OK: Your code can send one file to multiple receivers
TEST7: OK 0.5p
### TEST8: send one file to multiple receivers with loss (0.5p)
OK: Your code can send one file to multiple receivers
TEST8: OK 0.5p
### TEST9: send multiple files to other receiver without loss (0.5p)
OK: Your code can send multiple files to other receiver
TEST9: OK 0.5p
### TEST10: send multiple files to other receiver with loss (0.5p)
OK: Your code can send multiple files to other receiver
TEST10: OK 0.5p
### TEST11: receive multiple files from other sender without loss (0.5p)
OK: Your code can receive one file from other sender
TEST11: OK 0.5p
### TEST12: receive multiple files from other sender with loss (0.5p)
OK: Your code can receive one file from other sender
TEST12: OK 0.5p
##########
IMPORTANT: You pass only if scores of TEST1-6 >=2.5 points and TEST1-12 >=3.0 points.
You get the scores only when you pass. Otherwise, you get 0 points
RESULTS: PASS
SCORE: 6.0
##########
OK: Code compiles without error.
### TEST1: Check sender packet content (0.5p)
OK: GUDP version must be 1
OK: First packet is GUDP BSN (type 2)
OK: Sequence number is random and not zero or one
OK: BSN packet contains only GUDP header
OK: GUDP version must be 1
OK: Second packet is GUDP DATA (type 1)
OK: Sequence number should be random and not zero
OK: Second packet has an increment sequence number
OK: data packet seems to contain GUDP header + payload
TEST1: OK 0.5p
### TEST2: send and receive files with your code without loss (0.5p)
OK: Your code can send and receive one file
OK: Your code can send and receive multiple files
TEST2: OK 0.5p
### TEST3: send one file to other receiver without loss (0.5p)
OK: Your code can send one file to other receiver
TEST3: OK 0.5p
### TEST4: send one file to other receiver with loss (0.5p)
OK: Your code can send one file when first BSN is lost
OK: Your code can send one file when first DATA is lost
OK: Your code can send one file when first FIN is lost
OK: Your code can send one file when first ACK is lost
OK: Your code can send one file with random loss
TEST4: OK 0.5p
### TEST5: receive one file from other sender without loss (0.5p)
OK: Your code can receive one file from other sender
TEST5: OK 0.5p
Example test output
Send
Queue
Example of send and receive implementation
2023-09-07 23
SEND
Application
- Handle send end point
- Wrap app data in GUDP
- Put it in send queue
- Take GUDP from send queue
- Wrap it in UDP and send
- Handle timeout/retransmission
send() Send
thread Network
Network
receive
thread
- Process GUDP packet
BSN: Create receive end point
DATA: Update receive end point and
put GUDP DATA in receive queue
ACK: Update send queue
- FIN: Mark end point for removal
Receive
Queue
receive()
Pick up GUDP from input queue
Unwrap GUDP to get app data
Application
RECEIVE
Useful resources
2023-09-07 24
• Course book: 8th and 7th edition
‒ Read Chapter 3.4 through Chapter 3.4.3 Go-Back-N (GBN)
• TCP Operational Overview and the TCP Finite State Machine (FSM)
• Producer-consumer in Java: Baeldung, geeksforgeeks
• Java queue implementations: Oracle, Baeldung, geeksforgeeks,
• Java documentation for different classes:
‒ DatagramSocket, DatagramPacket,
‒ LinkedList, ArrayDeque
• Java wait() and notify() methods
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
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
软件定制开发网!