Advertisement
pexea12

Chapter 2 - Network

Apr 6th, 2016
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.45 KB | None | 0 0
  1. Creating a newtork app
  2. run on different end system
  3. communicate over network
  4. web server software communicates with browser software
  5. No need to write software for network-core devices
  6.  
  7. Application architectures:
  8. Client-server
  9. P2P (peer-to-peer)
  10. Hybrid of client-server and P2P
  11.  
  12. Client-server:
  13. server:
  14. always on host
  15. permanent IP address
  16. server farms for scaling
  17. client:
  18. communicate with server
  19. maybe intermittently connected
  20. may have dynamic IP addresses
  21. do not communicate directly with each other
  22.  
  23.  
  24. P2P:
  25. no always-on server
  26. arbitrary end systems directly communicate
  27. peers are intermittently connected and change IP addresses
  28. Highly scalable but difficult to manage
  29.  
  30. Hybrid of client-server and P2P:
  31. Skype: Voice-over-IP
  32. centralized server: finding address of remote party
  33. client-client connection (direct, not through server)
  34. Instant messaging:
  35. chatting between 2 users: P2P
  36. centralized service: client presence detection/location
  37.  
  38. Processes communicating
  39. same host: 2 processes inter-process communication
  40. exchanging message
  41.  
  42. Client process: process that initiates communication
  43. Server process: process that waits to be contacted
  44.  
  45. Sockets:
  46. process sends/receives messages to/from its socket
  47.  
  48. Addressing processes:
  49. to receive messages, process must have identifier
  50. IP address + port number
  51.  
  52. App-layer protocol:
  53. Types of messages exchanged
  54. Message syntax
  55. Message semantics
  56. Rules for when and how processes send and respond to messages
  57.  
  58. Public domain protocols: defined in RFCs, allows for interoperability
  59. HTTP, SMTP, BitTorrent
  60. Proprietary protocols: Skype, ppstream
  61.  
  62. Transport services that an app needs:
  63. Data loss
  64. Timing
  65. Throughput
  66. Security
  67.  
  68. TCP service:
  69. connection-oriented
  70. reliable transport
  71. flow control
  72. congestion control
  73. does not provide: timing, minimum throughput guarantees, security
  74.  
  75. UDP service:
  76. unreliable data transfer
  77. does not provide:
  78. connection setup
  79. reliability
  80. flow control
  81. congestion control
  82. timing, throughput guarantee, security
  83.  
  84. Web and HTTP:
  85. Wep page consists of objects, base HTML file
  86. Each objects is addressed by a URL (hostname + pathname)
  87.  
  88. HTTP: hypertext transfer protocol:
  89. web's application layer protocol
  90. client/server model:
  91. client: browser requests, receives, displays Web objects
  92. server: Web server sends objects in response to request
  93.  
  94. use TCP:
  95. client initiates TCP connection, create socket, port 80
  96. server accept TCP connection from client
  97. HTTP msg exchange between browser (HTTP client) & Web server (HTTP server)
  98. TCP connection close
  99.  
  100. stateless: server maintain no info about past client requests
  101.  
  102. HTTP connections:
  103. Nonpersistent HTTP: at most 1 object is sent over a TCP connection
  104. Persistent HTTP: multiple objects can be sent over single TCP connection
  105.  
  106. Nonpersistent HTTP:
  107. HTTP clients initiates TCP connection to HTTP server
  108. HTTP server and host wait for TCP connection at port 80, accept connection, notify client
  109. HTTP client send HTTP request msg into TCP connection socket
  110. HTTP server receives request msg, form response msg, send msg to socket
  111. HTTP server close TCP connection
  112. HTTP client receive response msg contain html file, display html
  113.  
  114. Nonpersistent HTTP:
  115. RTT: time for a small packet to travel from client to server and back
  116. Response Time:
  117. one RTT to initiate TCP connection
  118. one RTT for HTTP request and first few bytes of HTTP response to return
  119. file transmission time
  120.  
  121. total = 2RTT + transmit time
  122.  
  123. Persistent HTTP:
  124. Nonpersistent HTTP:
  125. require 2 RTT per object
  126. OS overhead for each TCP connection
  127. browser open parallel TCP connection to fetch
  128.  
  129. Persistent HTTP:
  130. server leaves connection open after sending response
  131. subsequent HTTP msg between same client/server sent over open connection
  132. clent send request as soon as it encounter a reference object
  133. 1 RTT for the reference object
  134.  
  135. HTTP msg:
  136. Request msg:
  137. request line (GET, POST, HEAD)
  138. header lines
  139. carriage return, line feed indicate end of msg
  140. Response msg:
  141. status line (protocol status code, status phrase)
  142. header lines
  143. data (requested HTML file)
  144.  
  145. POST method:
  146. include for input
  147. input is uploaded to server in entity body
  148.  
  149. URL method:
  150. use GET method
  151. input is uploaded in URL field of request line
  152.  
  153. HTTP 1.0 (GET, POST, HEAD)
  154. HTTP 1.1 (GET, POST, HEAD, PUT, DELETE)
  155.  
  156. HTTPp response:
  157. 200 OK
  158. 301 Moved Permanently
  159. 400 bad request
  160. 404 not found
  161. 500 http version not supported
  162.  
  163. User-server state: cookies
  164. cookie header line of HTTP response msg
  165. cookie header line in HTTP request msg
  166. cookie file kept on user host, manage by user browser
  167. back-end database at Website
  168.  
  169. authorization
  170. recommendations
  171. user sessions tate
  172. shopping carts
  173.  
  174. Web cache (proxy server)
  175. satisfy client request without involving origin server
  176.  
  177. user sets browser: web accesses via cache
  178. browser sends all HTTP requests to cache:
  179. object in cache: cache returns object
  180. else cache request obj from origin server, then return obj to client
  181.  
  182. act as both client and server
  183. typically installed by ISP
  184.  
  185. reduce response time for client request
  186. reduce traffic on an institution's access link
  187. Internet dense with caches:
  188. enables poor content provider to effectively deliver content
  189.  
  190. Conditional GET:
  191. dont't send obj if cache has up-to-date cached version
  192. cache: specify date of cached copy in HTTP request:
  193. If-modified-since: <data>
  194. server: response contains no obj if cached copy is up-to-date
  195.  
  196. FTP:
  197. transfer file to/from remote host
  198. client/server model:
  199. clent: side that initiates transfer (eirther to/from remote)
  200. server: remote host
  201.  
  202. contact FTP server at port 21
  203. TCP: transport protocol
  204. client authorize over control connection
  205. client browser remote directory by sending commands over control connection
  206. when server receive file transfer command, server open 2nd TCP connection to client
  207. after transferring, server close data connection
  208.  
  209. FTP maintain state: current directiory, earlier authentication
  210.  
  211. Electronic Mail:
  212. user agents
  213. mail servers
  214. simple mail transfer protocol: SMTP
  215.  
  216. User agent:
  217. mail reader
  218. compse, edit, read mail msg
  219. outgoing, incoming msg store on server
  220.  
  221. Mail server:
  222. mailbox contain incoming msg for user
  223. msg queue of outgoing (to be sent) mail msg
  224. SMTP protocol between mail server to send email msg:
  225. client: sending mail server
  226. server: receiving mail server
  227.  
  228. use TCP (port 25)
  229. direct transfer (sending server to receiving server)
  230. 3 phases:
  231. handshaking (greeting)
  232. transfer of msg
  233. closure
  234.  
  235. command/response interaction:
  236. commands: ASCII text
  237. response: status code and phrase
  238.  
  239. msg must be in 7-bit ASCII
  240.  
  241. SMTP:
  242. persistent connection
  243. require msg (header + body) in 7-bit ASCII
  244. use CRLF.CRLF to determine end of msg
  245.  
  246. HTTP: pull
  247. SMTP: push
  248.  
  249. both have ASCII command/response, interaction, status code
  250.  
  251. HTTP: each obj encapsulate in its own response msg
  252. SMTP: multiple obj sent in multipart msg
  253.  
  254. SMTP format:
  255. header (to, from, subject)
  256. body (ASCII only)
  257.  
  258. Mail access protocol:
  259. SMTP: delivery storage to receiver's server
  260. POP: Post Office Protocol
  261. IMAP: Internet Mail Access Protocol
  262. HTTP: gmail, Hotmail, Yahoo! Mail
  263.  
  264. POP3 protocol:
  265. authorization phase:
  266. client commands: user, pass
  267. server response
  268. transaction phase:
  269. list msg numbers
  270. retrieve msg by number
  271.  
  272. POP3: download and delete mode
  273. cannot reread email if change client
  274. download and keep copy of msg of different client
  275. stateless across sessions
  276.  
  277. IMAP: keep msg in one place: server
  278. allow user to organize msg in folder
  279. keep user state across sessions
  280.  
  281.  
  282. DNS: Domain Name System
  283. distributed database: implement in hierarchy of many name servers
  284. application-layer protocol:
  285. host, routers, name servers to communicate to resolve names
  286. core Internet function
  287. complexity at network edge
  288.  
  289. DNS Service:
  290. hostname to IP address translation
  291. host aliasing
  292. mail server aliasing
  293. load distribution
  294.  
  295. not centralize DNS:
  296. single point of failure
  297. traffic volume
  298. distance centralized database
  299. maintenance
  300. doesn't scale
  301.  
  302. Root name server:
  303. contacted by local name server that cant resolve name
  304. contact authoritative name server if name mapping not known
  305. gets mapping
  306. return mapping to local name server
  307.  
  308. Top-level domain (TLD) server:
  309. responsible for com, org, net, edu ... and top-country domain (uk, fr, ca, jp)
  310. Network Solutions maintains server for com TLD
  311. Educause for edu TLD
  312.  
  313. Authoritative DNS server
  314. organization DNS server, providing authoritative hostname to IP mappings for organization server
  315. can be maintain by organization or service provider
  316.  
  317. Local name server:
  318. does not strictly belong to hierarchy
  319. each ISP has one (default name server)
  320. when host make DNS query, query is sent to its local DNS server
  321.  
  322. Query: Local DNS server
  323. -> root DNS server
  324. -> TLD DNS server
  325. -> authoritative DNS server
  326.  
  327. iterated query (local DNS server -> every other)
  328. recursive query (Below model )
  329.  
  330. DNS caching and updating records:
  331. any name server learns mapping, it caches mapping
  332. cache entries timeout after sometime
  333. TLD server typically cached in local name server
  334. update/notify mechanism
  335.  
  336. DNS protocol msg:
  337. msg header
  338. identification (16 bit)
  339. flags
  340. questions
  341. answers
  342. authority
  343. additional info
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement