Electronic Mail. DNS. P2P file sharing презентация

Содержание

Overview P2P file sharing (cont.) Socket programming with TCP Socket programming with UDP

Слайд 1Review of Previous Lecture

Electronic Mail

DNS

P2P file sharing


Слайд 2Overview

P2P file sharing (cont.)

Socket programming with TCP

Socket programming with UDP




Слайд 3P2P file sharing
Example
Alice runs P2P client application on her notebook computer
Intermittently

connects to Internet; gets new IP address for each connection
Asks for “Hey Jude”
Application displays other peers that have copy of Hey Jude.

Alice chooses one of the peers, Bob.
File is copied from Bob’s PC to Alice’s notebook: HTTP
While Alice downloads, other users uploading from Alice.
Alice’s peer is both a Web client and a transient Web server.
All peers are servers = highly scalable!


Слайд 4P2P: centralized directory
original “Napster” design
1) when peer connects, it informs central

server:
IP address
content
2) Alice queries for “Hey Jude”
3) Alice requests file from Bob

Слайд 5P2P: problems with centralized directory
Single point of failure
if the directory server

crashes, then the entire p2p application crashes
Performance bottleneck
a centralized server must maintain a huge database
Copyright infringement
Easy to shut down the directory servers by legal actions

file transfer is decentralized, but locating content is highly centralized


Слайд 6Query flooding: Gnutella
fully distributed
no central server
public domain protocol
many Gnutella clients implementing

protocol


overlay network: graph
edge between peer X and Y if there’s a TCP connection
all active peers and edges is overlay net
Edge is not a physical link
Given peer will typically be connected with < 10 overlay neighbors


Слайд 7Gnutella: protocol
File transfer:
HTTP
Query message sent over existing TCP connections
peers forward Query message

QueryHit sent over reverse path

Scalability:
limited scope flooding


Слайд 8Gnutella: Peer joining
Joining peer X must find some other peer in

Gnutella network: use list of candidate peers
X sequentially attempts to make TCP with peers on list until connection setup with Y
X sends Ping message to Y; Y forwards Ping message.
All peers receiving Ping message respond with Pong message
X receives many Pong messages. It can then setup additional TCP connections

Слайд 9Exploiting heterogeneity: KaZaA
Napster fully centralized
Gnutella floods in limited area
KaZaA:
Each peer is

either a group leader or assigned to a group leader.
TCP connection between peer and its group leader.
TCP connections between some pairs of group leaders.
Group leader tracks the content in all its children.


Слайд 10KaZaA: Querying
Each file has a hash and a descriptor
Client sends keyword

query to its group leader
Group leader responds with matches:
For each match: filename, hash, IP address
If group leader forwards query to other group leaders, they respond with matches
Client then selects files for downloading
HTTP requests using hash as identifier sent to peers holding desired file


Слайд 11DoS resilience in p2p file-sharing systems
P2p networks – highly replicated content
not

enough to protect against DoS attacks

Music industry places false content on p2p networks (e.g., KaZaA)
companies such as “Overpeer” and “Ratsnap” publicly publicly offer their pollution-based services

My dilemma…

Слайд 12DoS resilience in p2p file-sharing systems (cont.)
Modeling the propagation of polluted

files in the system
User-behavior factors
Willingness to share files
Persistence in downloading files
Negligence in cleansing the infected hosts
Designed and evaluated attacks against p2p networks
% of nodes needed to collapse the system
Hierarchical vs. structured p2p networks
Counter-measures
Reputations systems, randomization

Слайд 13Summary

P2P file sharing (cont.)

Socket programming with TCP

Socket programming with UDP


Слайд 14Socket programming
Socket API
introduced in BSD4.1 UNIX, 1981
explicitly created, used, released by

apps
client/server paradigm
two types of transport service via socket API:
unreliable datagram
reliable, byte stream-oriented

Goal: learn how to build client/server application that communicate using sockets


Слайд 15Socket-programming using TCP
Socket: a door between application process and end-end-transport protocol

(UDP or TCP)
TCP service: reliable transfer of bytes from one process to another

controlled by
application
developer

controlled by
operating
system

host or
server

controlled by
application
developer

controlled by
operating
system

host or
server


internet


Слайд 16Socket programming with TCP
Client must contact server
server process must first be

running
server must have created socket (door) that welcomes client’s contact
Client contacts server by:
creating client-local TCP socket
specifying IP address, port number of server process
When client creates socket: client TCP establishes connection to server TCP

When contacted by client, server TCP creates new socket for server process to communicate with client
allows server to talk with multiple clients
source port numbers used to distinguish clients (more in Chap 3)


Слайд 17Stream jargon
A stream is a sequence of characters that flow into

or out of a process.
An input stream is attached to some input source for the process, eg, keyboard or socket.
An output stream is attached to an output source, eg, monitor or socket.

Слайд 18Socket programming with TCP
Example client-server app:
1) client reads line from standard

input (inFromUser stream) , sends to server via socket (outToServer stream)
2) server reads line from socket
3) server converts line to uppercase, sends back to client
4) client reads, prints modified line from socket (inFromServer stream)


Client
process


client TCP socket


Слайд 19Client/server socket interaction: TCP
Server (running on hostid)
Client


Слайд 20Example: Java client (TCP)
import java.io.*;
import java.net.*;
class TCPClient {

public static void main(String argv[]) throws Exception
{
String sentence;
String modifiedSentence;

BufferedReader inFromUser =
new BufferedReader(new InputStreamReader(System.in));

Socket clientSocket = new Socket("hostname", 6789);

DataOutputStream outToServer =
new DataOutputStream(clientSocket.getOutputStream());


Create
input stream

Create
client socket,
connect to server

Create
output stream
attached to socket





Слайд 21Example: Java client (TCP), cont.
BufferedReader inFromServer =


new BufferedReader(new
InputStreamReader(clientSocket.getInputStream()));

sentence = inFromUser.readLine();

outToServer.writeBytes(sentence + '\n');

modifiedSentence = inFromServer.readLine();

System.out.println("FROM SERVER: " + modifiedSentence);

clientSocket.close();

}
}

Create
input stream
attached to socket

Send line
to server

Read line
from server





Слайд 22Example: Java server (TCP)
import java.io.*;
import java.net.*;

class TCPServer {

public static void main(String argv[]) throws Exception
{
String clientSentence;
String capitalizedSentence;

ServerSocket welcomeSocket = new ServerSocket(6789);

while(true) {

Socket connectionSocket = welcomeSocket.accept();

BufferedReader inFromClient =
new BufferedReader(new
InputStreamReader(connectionSocket.getInputStream()));


Create
welcoming socket
at port 6789

Wait, on welcoming
socket for contact
by client

Create input
stream, attached
to socket





Слайд 23Example: Java server (TCP), cont


DataOutputStream

outToClient =
new DataOutputStream(connectionSocket.getOutputStream());

clientSentence = inFromClient.readLine();

capitalizedSentence = clientSentence.toUpperCase() + '\n';

outToClient.writeBytes(capitalizedSentence);
}
}
}

Read in line
from socket

Create output
stream, attached
to socket



Write out line
to socket


End of while loop,
loop back and wait for
another client connection



Слайд 24Outline

P2P file sharing (cont.)

Socket programming with TCP

Socket programming with UDP



Слайд 25Socket programming with UDP
UDP: no “connection” between client and server
no handshaking
sender

explicitly attaches IP address and port of destination to each packet
server must extract IP address, port of sender from received packet
UDP: transmitted data may be received out of order, or lost

Слайд 26Client/server socket interaction: UDP
Server (running on hostid)


Слайд 27Example: Java client (UDP)

Output: sends packet (TCP sent “byte stream”)
Input: receives

packet (TCP received “byte stream”)

Client
process


client UDP socket


Слайд 28Example: Java client (UDP)
import java.io.*;
import java.net.*;

class UDPClient {


public static void main(String args[]) throws Exception
{

BufferedReader inFromUser =
new BufferedReader(new InputStreamReader(System.in));

DatagramSocket clientSocket = new DatagramSocket();

InetAddress IPAddress = InetAddress.getByName("hostname");

byte[] sendData = new byte[1024];
byte[] receiveData = new byte[1024];

String sentence = inFromUser.readLine();
sendData = sentence.getBytes();

Create
input stream

Create
client socket

Translate
hostname to IP
address using DNS





Слайд 29Example: Java client (UDP), cont.
DatagramPacket sendPacket =

new DatagramPacket(sendData, sendData.length, IPAddress, 9876);

clientSocket.send(sendPacket);

DatagramPacket receivePacket =
new DatagramPacket(receiveData, receiveData.length);

clientSocket.receive(receivePacket);

String modifiedSentence =
new String(receivePacket.getData());

System.out.println("FROM SERVER:" + modifiedSentence);
clientSocket.close();
}
}

Create datagram with data-to-send,
length, IP addr, port

Send datagram
to server

Read datagram
from server





Слайд 30Example: Java server (UDP)
import java.io.*;
import java.net.*;

class UDPServer {


public static void main(String args[]) throws Exception
{

DatagramSocket serverSocket = new DatagramSocket(9876);

byte[] receiveData = new byte[1024];
byte[] sendData = new byte[1024];

while(true)
{

DatagramPacket receivePacket =
new DatagramPacket(receiveData, receiveData.length);
serverSocket.receive(receivePacket);

Create
datagram socket
at port 9876

Create space for
received datagram

Receive
datagram





Слайд 31Example: Java server (UDP), cont

String sentence

= new String(receivePacket.getData());

InetAddress IPAddress = receivePacket.getAddress();

int port = receivePacket.getPort();

String capitalizedSentence = sentence.toUpperCase();

sendData = capitalizedSentence.getBytes();

DatagramPacket sendPacket =
new DatagramPacket(sendData, sendData.length, IPAddress,
port);

serverSocket.send(sendPacket);
}
}
}

Get IP addr
port #, of
sender


Write out
datagram
to socket


End of while loop,
loop back and wait for
another datagram


Create datagram
to send to client



Слайд 32Summary

P2P file sharing (cont.)

Socket programming with TCP

Socket programming with UDP



Слайд 33Application Layer: Summary
Application architectures
client-server
P2P
hybrid
application service requirements:
reliability, bandwidth, delay
Internet transport service

model
connection-oriented, reliable: TCP
unreliable, datagrams: UDP

Our study of network apps now complete!

specific protocols:
HTTP
FTP
SMTP, POP, IMAP
DNS
socket programming


Слайд 34Application Layer: Summary
typical request/reply message exchange:
client requests info or service
server responds

with data, status code
message formats:
headers: fields giving info about data
data: info being communicated

Most importantly: learned about protocols

control vs. data msgs
in-band, out-of-band
centralized vs. decentralized
stateless vs. stateful
reliable vs. unreliable msg transfer
“complexity at network edge”


Слайд 35Quiz (Application Layer)
Q1. List four Internet apps and the application layer

protocols

Слайд 36Quiz
Q2. What is the difference between network architecture and application architecture?


Слайд 37Quiz
Q3. In what way is instant messaging a hybrid of client-server

and P2P architectures?

Слайд 38Quiz
Q4. For a communication session between a pair of processes, which

process is the client and which is the server?

Слайд 39Quiz
Q5. Do you agree with the statement: “In P2p file sharing,

there is no notion of client and server sides of a communication session”?

Why or why not?

Слайд 40Quiz
Q6. What information is used by a process running on one

host to identify a process running on another host?

Слайд 41Quiz
Q9. What is meant by a handshaking protocol?


Слайд 42Quiz
Q10. Why HTTP, FTP, SMTP, POP3, and IMAP run on top

of TCP rather than UDP?

Слайд 43Quiz
Q12. What is the difference between persistent HTTP with pipelining and

persistent HTTP without pipelining?

Which of the two is used by HTTP/1.1?

Слайд 44Quiz
Q15. Why is it said that FTP sends control information “out-of-band”?


Слайд 45Quiz
Q19. Is it possible for an organization’s Web server and mail

server to have exactly the same alias for a hostname?

What would be the type for the RR that contains the hostname of the mail server?

Слайд 46Quiz
Q22. A UDP-based server needs only one socket, whereas the TCP

server needs two sockets. Why?

If the TCP server were to support n simultaneous connections, each from a different client host, how many sockets would the TCP server need?

Слайд 47Quiz (Chapter 1)
Q3. What is a client program?

What is a

server program?

Does a server program request and receive services from a client program?


Слайд 48Quiz
Q4. What are the two types of transport services that the

Internet provides to its applications?

Слайд 49Quiz
Q5. What is the difference between flow and congestion control?


Слайд 50Quiz
Q7. What advantage does a circuit-switched network has over a packet-switched

network?

Слайд 51Quiz
Q8. Why is it said that packet switching employs statistical multiplexing?


Слайд 52Quiz
Q12. List five Internet access technologies.

Classify each one as residential,

company access, or mobile access.

Слайд 53Quiz
Q15. Is cable-modem transmission rate dedicated or shared among users?

Are collisions

possible in the downstream channel?

Why or why not?

Слайд 54Quiz
Q19. Consider sending packet from a sending host to a receiving

host over a fixed route. List the delay components in the end-to-end delay.

Which of these delays are constant and which are variable?

Слайд 55Quiz
Q21. What are the five layers in the Internet protocol stack?



Слайд 56Quiz
Q23. Which layers in the Internet protocol stack does a router

process?

Which layers does a link-layer switch process?

Which layers does a host process?

Обратная связь

Если не удалось найти и скачать презентацию, Вы можете заказать его на нашем сайте. Мы постараемся найти нужный Вам материал и отправим по электронной почте. Не стесняйтесь обращаться к нам, если у вас возникли вопросы или пожелания:

Email: Нажмите что бы посмотреть 

Что такое ThePresentation.ru?

Это сайт презентаций, докладов, проектов, шаблонов в формате PowerPoint. Мы помогаем школьникам, студентам, учителям, преподавателям хранить и обмениваться учебными материалами с другими пользователями.


Для правообладателей

Яндекс.Метрика