程序代做CS代考 Java flex Week 7: Transport Layer Internet Technologies COMP90007 – cscodehelp代写

Week 7: Transport Layer Internet Technologies COMP90007
Lecturer: Semester 2, 2021
© University of Melbourne 2020
1

Connection Release
n Asymmetric Disconnection
q Either party can issue a DISCONNECT, which results in DISCONNECT TPDU and transmission end in both directions
n Symmetric Disconnection
q Both parties issue DISCONNECT, closing only one direction at a time – allows flexibility to remain in receive mode
2

Connection Release (Cont.)
n Asymmetric vs Symmetric connection release types
n Asymmetric release may result in data loss hence symmetric release is more attractive
n Symmetric release works well where each process has a set amount of data to transmit and knows it has been sent
3

Generalizing the Connection Release Problem
n How do we decide the importance of the last message? Is it essential or not?
n No protocol exists which can resolve this ambiguity – Two-army problem shows pitfall of agreement
Attack? Attack?
4

Strategies for Connection Release
n 3 way handshake n Finite retry
n Timeouts
n Normal release sequence, initiated by transport user on Host 1
q DR=Disconnect Request
q Both DRs are ACKed by the other side
5

Connection Release (Error Cases)
n Error cases are handled with timers and retransmission
Final ACK lost, Host 2 times out
Lost DR causes retransmissions
Extreme: Many lost DRs cause both hosts to timeout
6

Addressing
n Specification of remote process to connect to is required at application and transport layers
n Addressing in transport layer is typically done
using Transport Service Access Points (TSAPs)
q on the Internet, a TSAP is commonly referred to as a port (e.g. port 80)
n Addressing in the network layer is typically done
using Network Service Access Points (NSAPs)
q on the Internet, the concept of an NSAP is commonly interpreted as simply an IP address
7

TSAPs, NSAPs and Transport Layer Connections Illustrated
8

Types of TSAP Allocation
1.
2.
3.
Static
q Well known services have standard allocated TSAPs/ports, which are embedded in OS
q
Directory Assistance – Port-mapper
A new service must register itself with the portmapper, giving both its service name and TSAP
Mediated
q A process server intercepts inbound connections and spawns requested server and attaches inbound connection
q cf. Unix /etc/(x)inetd
9

Programming using Sockets
n Sockets widely used for interconnections
q “Berkeley” sockets are predominant in internet applications
q Notion of “sockets” as transport endpoints
q Like the simple set plus SOCKET, BIND, and ACCEPT
10

Recall Example Pseudo Code
Socket A_Socket = createSocket(“TCP”); connect(A_Socket, 128.255.16.0, 80); send(A_socket, “My first message!”); disconnect(A_socket);
… there is also a server component for this client that runs on another host…
11

SERVER
CLIENT
socket() bind() listen () accept()
read() write()
close()
socket()
Connection request
connect()
write()
read() close()
Connection established
12

Let’s Look at the Code from the book (in a specific language)
Example from the book has more details but the essence is the same… This is the case in most languages…
13

Socket Example – Server Side
Server code. . .

Assign address
Prepare for incoming connections
14

Server Code Contd
Block waiting for the next connection
Read (receive) request
…..
The server can also create a new thread to handle the
connection on the new socket and go back to waiting for the next connection on the original socket…
15

An Example on Multi-Threading
ServerSocket serverSocket = new ServerSocket([parameters]);
While (true) {
Socket socket = serverSocket.accept();
MultiThreadMyServer server = new MultiThreadMyServer();
server.setMyService([some more parameters]);
server.setSocket(socket);
new Thread(server).start();
….
n (Code from OO Programming with Java; Chp. 14)
16

Looking under the hood for Transport Layer Services…
n The most basic is actually connectionless: q Called: User Datagram Protocol (UDP)
q Does not add much to the Network Layer functionality
q TCP we just does the real-deal for this layer, reliability…
q For UDP: Just remove connection primitives to use it in a program
q UDP good for?:
n It is used for apps like video streaming/gaming regularly
q The reliability issue is left to?:
n the application layer… retransmission decisions as well as congestion control
18

: UDP Client…
public static void main(String args[]) { ….
DatagramSocket mySocket = new DatagramSocket();
mySocket.send([data,address, etc parameters]);
… }
19

Server Side: UDP Example Contd
public static void main(String args[]) { ….
DatagramSocket server = new DatagramSocket(port);
while (true) { server.receive([parameters]); …
}}
20

Leave a Reply

Your email address will not be published. Required fields are marked *