Upload
stacy-shawley
View
230
Download
0
Embed Size (px)
Citation preview
Lab312
Lab312 專題生暑假需知• 每一課程都會有作業 • 且點名與作業表現將影響專題生是否能續留本實驗室 • 修習本實驗室之專題生務必要出席 • 在開學前會公告 final project 的機測時間,詳細資訊請看
Room312 板 • 點名 + 課程作業 +final project 此為續留本實驗室之條件
缺一不可
protocol
• 大概說說 TCP
• 大概說說 HTTP
TCP
• Transmission Control Protocol• point-to-point:
– one sender, one receiver
• reliable, in-order byte steam:– no “message boundaries
• connection-oriented: – handshaking (exchange of control msgs) init’s sender, receiver
state before data exchange
TCP
• Transmission Control Protocol
TCP
socketdoor
T C Psend buffer
T C Preceive buffer
socketdoor
segm ent
applicationwrites data
applicationreads data
TCP
source port # dest port #
32 bits
applicationdata (variable length)
sequence number
acknowledgement number
Receive window
Urg data pnterchecksum
FSRPAUheadlen
notused
Options (variable length)
URG: urgent data (generally not used)
ACK: ACK #valid
PSH: push data now(generally not used)
RST, SYN, FIN:connection estab(setup, teardown
commands)
# bytes rcvr willingto accept
countingby bytes of data(not segments!)
Internetchecksum
(as in UDP)
TCPSeq. #’s:
– byte stream “number” of first byte in segment’s data
ACKs:– seq # of next byte
expected from other side
– cumulative ACK
Q: how receiver handles out-of-order segments– A: TCP spec doesn’t
say, - up to implementor
Host A Host B
Seq=42, ACK=79, data = ‘C’
Seq=79, ACK=43, data = ‘C’
Seq=43, ACK=80
Usertypes‘C’
host ACKsreceipt of echoed‘C’
host ACKsreceipt of‘C’, echoesback ‘C’
timesimple telnet scenario
HTTP
• Hypertext Transfer Protocol• Web page consists of objects• Object can be HTML file, JPEG image, Java applet,
audio file,…• Web page consists of base HTML-file which includes
several referenced objects• Each object is addressable by a URL• Example URL:
www.someschool.edu/someDept/pic.gif
host name path name
HTTP
HTTP: hypertext transfer protocol
• Web’s application layer protocol
• client/server model– client: browser that
requests, receives, “displays” Web objects
– server: Web server sends objects in response to requests
• HTTP 1.0: RFC 1945• HTTP 1.1: RFC 2068
PC runningExplorer
Server running
Apache Webserver
Mac runningNavigator
HTTP request
HTTP request
HTTP response
HTTP response
HTTP Request Message
• two types of HTTP messages: request, response• HTTP request message:
– ASCII (human-readable format)
GET /somedir/page.html HTTP/1.1Host: www.someschool.edu User-agent: Mozilla/4.0Connection: close Accept-language:fr
(extra carriage return, line feed)
request line(GET, POST,
HEAD commands)
header lines
Carriage return, line feed
indicates end of message
HTTP Request Message
HTTP Method
HTTP/1.0• GET• POST• HEAD
– asks server to leave requested object out of response
HTTP/1.1• GET, POST, HEAD• PUT
– uploads file in entity body to path specified in URL field
• DELETE– deletes file specified in
the URL field
HTTP Response Message
HTTP/1.1 200 OK Connection closeDate: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 Content-Type: text/html data data data data data ...
status line(protocol
status codestatus phrase)
header lines
data, e.g., requestedHTML file
HTTP Response Status Codes
200 OK– request succeeded, requested object later in this message
301 Moved Permanently– requested object moved, new location specified later in this
message (Location:)
400 Bad Request– request message not understood by server
404 Not Found– requested document not found on this server
505 HTTP Version Not Supported
In first line in server->client response message.A few sample codes:
WireShark
• Wireshark (前稱 Ethereal )是一個網路封包分析軟體。網路封包分析軟體的功能是擷取網路封包,並盡可能顯示出最為詳細的網路封包資料。
安裝 WireShark
安裝 WireShark
安裝 WireShark
安裝 WireShark
安裝 WireShark
WireShark
WireShark
WireShark
WireShark
WireShark
作業一• 1. 利用 wireshark 錄製連線封包,並標出 three
way handshake 步驟的幾個封包。
• 2. 找出 TCP Header 中 Sequence number 以及Acknowledgment number 欄位是做什麼用途,在連線過程中裡面的內容代表什麼意義,請清楚說明。
• Mail 到 [email protected]• mail 標題 :Lab312 作業一• Mail 內容 : 請包含學號、姓名。• Due:8/4