Network App Requirement
timing, throughput, security, reliability (data integrity)
Network apps principles
Network app development writes program that run on end system and communicate over the network, no need to write software for network core devices.
Peer to peer (P2P)
No always on server, end system communicate directly, peer request service from other peer and provide service in return, peers intermittently connected and change ip address.
Server
Always on host, permanent ip address
Client
Communicate with server directly, may intermittently connected, have dynamic ip address, do not communicate directly
Data center
house large number of host, create powerful virtual server, popular internet services employ one or more of this thing, can have hundreds thousands of server.
Process meaning
Program running within a host
process in same host communicate using
inter-process communication (defined by os)
process in different host communicate by
exchanging messages
client process
process that initiates connection
server process
process that waits to be connected
Sockets function
Process send/receives messages to/from its socket
Sockets meaning
Interface between application process and transport layer protocol
Identifier
To receive process that includes ip address and port numbers associated with process on host
App-layer protocols define
types of messages exchanges, message syntax, message semantic, rules, open protocols, proprietary protocols
TCP
reliable transport, flow control, congestion control, does not provide (timing, minimum throughput guarantee, security) , connection oriented
UDP
unreliable data transfer, does not provide:- reliability, flow control, congestion control, timing, throughput guarantee, security or connection setup.
Transport Layer Security (TCP)
provides encrypted TCP connection, data integrity, end point authentication, implimneted at application layer.
Web
Operates on demand, everyone can be content publisher, hyperlink and search engines help find published contents, contents exhibited beautiful graphics, serves as a platform for many applications.
Web page consists of
objects such as HTML, JPEG and audio files
object is
a collection of items that can be called from a single URL
HTTP implemented in 2 programs
client that request, receives, displays web objects and server sends object in response to request.
HTTP use
TCP that sends request messages into its socket interface.
What does stateless protocol in HTTP mean?
the server sends requested files to clients without storingany state information about the client, server maintains no information about past client requests, When client ask for the same object repeatedly ➔ theserver will resend
RTT
time for small packet to transfer between client to server and back.
Non-persistent HTTP issues
each object requires 2 RTT delay, Operating System (OS)overhead for each TCPconnection – can burden theserver, browsers often open multipleparallel TCP connections tofetch referenced objects
Non-persistent HTTP
one RTT to initiate TCP connection, one RTT for HTTP reuqest and first few bytes of HTTP response to return, response time = 2RTT+file transmission time
Persistent HTTP
server leaves connection open after response, subsequent HTTP messages between same client/server sent over open connection, client send request as soon as it encounters referenced object, as little as one RTT for all the referenced object.
HTTP POST method
web page often includes from input, user input sent from client to server by post method
HTTP GET method
method to get specific object from server
HTTP HEAD method
only request header
HTTP PUT method
uploads file to server, replace file at specified URL
Status code 200 ok
request succeeded, requested object later in this message
status code 301 moved permanently
requested object moved, new location specified later in this message (in the Location: field)
status code 400 bad request
request message not understood by server
status code 404 not found
requested document not found on this server
Cookies
able to maintain user/server state, help web servers handle thousand of simultaneous connections
Cookies use for
authorization, shopping carts, recommendations, user session state
Cookies components
cookies header line of HTTP response message, cookie header line in next HTTP request message, cookies file kept o user's host thats managed by user's browser, back-end database at web site
Web caches ( proxy server ) goal
satisfy client request without involving origin server
How web cache works?
user configures browser topoint to (local) Web cache, browser sends all HTTPrequests to cache, If object in cache: cachereturns object to client, else cache requests objectfrom origin server, cachesreceived object, thenreturns object to client, acts as both client and server, typically installed by isp
Web cache benefits
reduce response time, reduce traffic on access link, effectively delivers content
Conditional GET goal
don't send object if cache has up to date cached version thus no transmission delay and lower link utilization.
Conditional GET client :
specify date of cached copy in HTT PrequestIf-modified-since: <date>
Conditional GET server:
response contains no object if cached copy is up-to-date:HTTP/1.0 304 Not Modified
HTTP/2 goal
decreases delay in multi object http request
HTTP/1.1 introduce
multiple pipelined Gets over single TCP connection, server responds in-order (FCFS: first-come-first-served scheduling) to GET requests. with FCFS, small object may have to wait for transmission (head-of- line (HOL) blocking) behind large object(s). loss recovery (retransmitting lost TCP segments) stalls object transmission
HTTP/2
increased flexibility at server in sending objects to client. method, status code, most header files unchanged from HTTP 1.1. Transmission order of requested objects based on client-specified object priority. push unrequested objects to client. divide objects into frames, schedule frames to mitigate HOL blocking.
File Transfer Protocol ( FTP )
user transfer file to or from a remote host.
for user to access remote account, user must
provide a form of authentication (Username n password)
FTP uses
client/server model
FTP
Runs on TCP, RFC 959 and server port 21
FTP uses 2 parallel TCP connection which is
control connection to send control info and data connection for actual files transfer
In FTP, when server received file transfer command
server open 2nd TCP data connetion for file to client with port 20. After transferring exactly one file, server closes data connection.
How HTTP works
client initiate TCP connection to server (port 80), server accept TCP connection from client, HTTP messages exchange between client and server, tcp connection closed