Click here to load reader

第 9 章 因特网的应用

Embed Size (px)

DESCRIPTION

第 9 章 因特网的应用. 本章内容 域名系统( DNS ) 远程登录( Telnet ) 电子邮件( E-mail ) 文件传输( FTP ) 万维网( WWW ) * 因特网的多媒体应用. 9.1 域名系统( DNS ). DNS ( RFC 1035 )也是 TCP/IP 的应用层协议之一。它利用了 UDP 传输层协议,端口为 53 。. 因特网编址机制:三种形式的地址管理机制 域名地址 : www.xjtu.edu.cn 层次化的地址,便于人们记忆。 IP 地址 : 202.117.0.20 - PowerPoint PPT Presentation

Citation preview

  • 9 DNSTelnetE-mailFTPWWW*

  • 9.1 DNSwww.xjtu.edu.cnIP202.117.0.2032 TCP/IPIPIPDomain Name SystemDNSName ResolutionMAC12-FA-9B-23-DB-1148/ IPMACARPDNSRFC 1035TCP/IPUDP53

  • IPIPIPIPIPwwwFTPIPIP

  • root

    com net org edu gov mil int cn uk hk ...

    ibm hp intl 3com

    com edu gov net

    tsinghua pku sjtu fudan xjtu

    www mail ftp bbs

  • .63255www.xjtu.edu.cnnetcourse.xjtu.edu.cnxjtu.edu.cn

  • DNSDNSDNSDNSDNSDNSDNSDNSIPDNS202.117.0.20xjtu.edu.cnIPDNSDNSDNS202.117.0.21

  • DNSLocal Name Server/DNSRoot Name ServerAuthoritative Name ServerDNSDNS

  • DNSDNSDNSDNSDNSDNS DNSDNSDNSDNSDNSDNS

  • Awww.xjtu.edu.cnxjtuIPADNS1DNS1xjtuJDIPADNS1xjtuDNS1cnBIPDNS1DNS1Bedu.cnDNSCDNS1Cxjtu.edu.cnDNSDDNS1Dwww.xjtu.edu.cnIPnslookupDNS

  • AAddress A IP NSName ServerDNS CNAME WWWFTPMAIL[]MXMail Exchanger[]PTR DNS202.117.0.20PTRSOADNSabc.mydomain.comA WWWMAILCNAMEWWWMAIL www.mydomain.commail.mydomain.comabc.mydomain.comInternet [email protected] DNSmail.mydomain.comMXDNSMX MX

  • DNSRRs

  • DNSARPDNS()IP()ARP IP() MAC() DNSARPLANDNSARPLAN

  • 9.2 TelnetTelnetTelnetTelecommunication Network ProtocolIPUNIX

  • Telnet Server Username:Password:

    InternetTelnet

  • TelnetTelnetClient/ServerTCPTelnetTCPTCP,TelnetTelnetTCP

  • Telnettelnettelnet [remote-system] [port-number]telnet NVT220remote-system()IPport-number telnet telnet23telnet telnet>

  • UNIX $telnet www.xjtu.edu.cn $telnet 202.117.35.70 IP $telnettelnettelnet> open telnet>open www.xjtu.edu.cn telnet>open 202.117.35.70

  • login passwordemaillynxpicolspwdexitlogoutCtrl-D

  • 9.3 E-mail90User AgentOutlookOutlook ExpressFoxmail

  • E-mail Server/SMTPSimple Mail Transfer Protocol[RFC 821822]MIMEMultipurpose Internet Mail Extension[RFC 1521]POP3Post Office Protocol[RFC 1939]IMAP4Internet Message Access Protocol[RFC 2060]

  • TCPTCPTCPTCP SMTPTCP SMTPSMTPSMTP TCP POP3 SMTP

    Cloud

    Processor

    Minicomputer

    Workstation

    Internet

    E-mail Server

    E-mail Server

    User Agent

    SMTP

    SMTP

    User Agent

    POP3

    OutlookFoxMail

    OutlookFoxMail

  • @ @[email protected]@xaonline.com

  • SMTPSMTPTCPSMTP25TCPSMTPRFC821RFC822SMTP7ASCIISMTP

  • [RFC822]headerbody

  • Received: from web10905.mail.yahoo.com (unknown [216.136.131.41])by 192.168.30.102 (Coremail) with SMTP id XQEAACPEeD3FAIMp.1for ; Fri, 06 Sep 2004 23:05:16 +0800 (CST)Message-ID: Received: from [67.242.159.232] by web10905.mail.yahoo.com via HTTP; Fri, 06 Sep 2004 08:11:04 PDTDate: Fri, 6 Sep 2004 08:11:04 -0700 (PDT)From: Joy Li Subject: ThanksTo: ChenWenge Cc: [email protected]: MIME-Version: 1.0Content-Type: text/plain; charset=us-ascii

    012345678 21

  • Received From DateMessage-ID To SubjectContent-typeMIME CcCarbon copy

  • SMTPSMTP/SMTPSMTPHELOMAIL FROMRCPT TODATAQUIT

  • TelnetSMTP $ Telnet mail.xjtu.edu.cn 25 Trying 202.117.1.21... Connected to mail.xjtu.edu.cn. Escape character is '^]'. 220 ESMTP ready [202.117.35.70/unknown] HELO 250 MAIL FROM 250 OK RCPT TO 250 OK DATA 354 go ahead This is a test message. Be sure is send by Telnet. . 250 OKhas queued QUIT 221 close connection Connection closed by foreign host. TCPSMTP//email25

  • SMTPMessageASCIIMIMEASCII

  • E-mailUU(Unix-to-Unix Encoding) UnixDOSASCIIUUMIME(Multipurpose Internet Mail Extensions) MIMEInternetMIMEBase64QP(Quote-Printable)QP787QPASCII,QP16=QP=A4j=AEa=A6n=A1I=A7=DA=AC0=B1=E7=A9s=A7g=A1A=AB=DC=B0Base647 Base64pGquYaZuoUmn2qxPseepc6dnoUGr3LCqv70msMIMEEmailQPBase64 Binhex BinhexAppleMacPC

  • POP3IMAPPOP3TCP/Outlook ExpressFoxmailExchangeTCPPOP

  • IMAPTCPPOP3/POP3IMAPIMAPWeb Mail

  • Outlook ExpressOutlook

  • Outlook Express.emlOutlookExcelOutlookOEExcel

  • Outlook Express

  • 9.4 FTPFTPFTPFile Transfer ProtocolUploadPutDownloadGetFTPASCIIBinaryFTPFTPAnonymous

  • Software ProgramDocumentsVideoAudioftp ftp.xjtu.edu.cnUsername: anonymousPassword: [email protected] FTP Serverftp.xjtu.edu.cn

  • FTPFTPTCPTCPFTP/FTPCuteftpFTPServ-U

  • FTPTCPControl ConnectionFTP21,FTPFTPData ConnectionFTP20FTP

  • TCPFTPTCPFTPX2120Y

  • FTP1 TCP SYNTCP21 2SYN ACK213ACKFTPFTP

  • PORTPORT 1SYN20PORT2SYN ACK20 3ACK

  • 1FIN2ACK3FIN4ACK FTP1FIN2ACK3FIN4ACK

  • ftp Client ftp Server TCP:21 , SYN Port xxxx ----------------------> Port 21 SYN, ACK Port xxxx Port 21

    : Port, IP, Port yyyy Port xxxx ----------------------> Port 21 Port Successful Port xxxx Port 21

    TCP:20 , SYN Port yyyy Port 20 ACK Port yyyy

  • FTPFTPFTP [host] %ftp ftp.xjtu.edu.cn ftp>open ftp.xjtu.edu.cn usernamecw024001001 password****** usernameanonymous [email protected]

  • 1ftpftp>?ftp>helpftpopenftp>help open2ftp>open host ftp>close ftpftp>disconnect ftpftp>bye ftpftp>quit ftp

  • 3ftp>pwd ftp>cd ftp>cdup ftp>ls [remote-dir] [local-file] ftp>mls remote-file local-file txtdirfile.list ftp>mls *.txt dirfile.listftp>nlist - [remote-dir] [local-file] rtrcftp>nlist -rt /disk1/test test.list

  • 4ftp>put local-file [remote-file] ftp>send local-file [remote-file]ftp>append local-file [remote-file]ftp>mput local-file ftp>get [local-file] remote-fileftp>recv [local-file] remote-fileftp>reget [local-file] remote-file getftp>mget remote-file

  • FTP ClientFTP Serverput mputget mgetrecv regetsend append

  • 5ftp>ascii ftp>binary 6ftp>chmod mode remote-file modeftp>chmod 666 aa 7ftp>get filename -filename-8renamedeletemdeletesize

  • FTP[01]~[15] [01] ftp ftp.xjtu.edu.cn[02] Connected to vineyard.xjtu.edu.cn.[03] 220 vineyard.xjtu.edu.cn FTP server (Version wu-2.5.0(1) Tue Jul 13 10:20:43 CDT.[04] Name (ftp.xjtu.edu.cn:teng): anonymous[05] 331 Guest login ok, send your complete e-mail address as password.[06] Password: [email protected][07] 230 Guest login ok, access restrictions apply.[08] ftp>cd /pub/rfc[09] 250 CWD command successful.[10] ftp>get rfc959.txt ftpinfo[11] 200 PORT command successful.[12] 150 Opening ASCII mode data connection for rfc959.txt (147316 bytes).[13] 226 Transfer complete. local: ftpinfo remote: rfc959.txt 151249 bytes received in 2.1 seconds (71.27 Kbytes/s)[14] ftp>quit[15] 221-You have transferred 151249 bytes in 1 files. 221-Total traffic for this session was 152964 bytes in 1 transfers. 221-Thank you for using the FTP service on vineyard.xjtu.edu.cn. 221 Goodbye.

  • [01] FTPFTPFTPftp.xjtu.edu.cn[02] FTP[03] 220[04] FTPanonymousFTP[05] [06] [email protected][07] 230[08]ftp>FTPhelp,dircdRFC[09] CWDChange Working Directory[10] rfc959.txtftpinfo[11] PORT200[12] 150[13] 226[14] [15] FTP

  • FTPWindowsFTPFTP WS_FTP CuteFTP LeapFTP LeechFTP FTP 202.117.35.70 k1010anonymous xxxx abc@edf c:\ /home/k1010 /pub

  • FTPFTPWindowsFTPWS_FTPCuteFTPLeapFTPLeechFTP FTP IP anonymous xxxxxx [email protected]

  • FTP(cuteftp)

  • 4.4 FTP

  • 4.5 WWWBrowserWebWebWebWeb

  • HypertextLink)Hyperlink)Hypermedia

  • WebWebAPACHE (Hypertext Markup LanguageHTML)WebWebHypertext Transport ProtocolHTTPWeb

  • WWWHTTPHTTP

  • HTTPClient/ServerHTTPHTTPURL

  • HTTP(content-type)HTTPHTTP

  • HTTPHTTP

  • HTTP(Meta Information)HTTPHTTP

  • http : request http messages: request, responsehttp request message:ASCII ()GET /somedir/page.html HTTP/1.0 User-agent: Mozilla/4.0 Accept: text/html, image/gif,image/jpegAccept-language:fr

    (extra carriage return, line feed) request line(GET, POST, HEAD commands)header linesCarriage return, line feed indicates end of message

  • http request message: general format

  • http: responseHTTP/1.0 200 OK Date: 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(protocolstatus codestatus phrase)header linesdata, e.g., requestedhtml file

  • http 200 OKrequest succeeded, requested object later in this message301 Moved Permanentlyrequested object moved, new location specified later in this message (Location:)400 Bad Requestrequest message not understood by server404 Not Foundrequested document not found on this server505 HTTP Version Not SupportedIn first line in server->client response message.A few sample codes:

  • Trying out http (client side) for yourself1. Telnet to your favorite Web serverOpens TCP connection to port 80(default http server port) at www.eurecom.fr.Anything typed in sent to port 80 at 202.117.35.70telnet 202.117.35.70 802. Type in a GET http requestGET /~k1010/hello.html HTTP/1.0By typing this in (hit carriagereturn twice), you sendthis minimal (but complete) GET request to http server3. Look at response message sent by http server!

  • Conditional GETClienthttp requestIf-modified-since: ServerHTTP/1.0 304 Not Modifiedclientserverhttp request msgIf-modified-since: object not modifiedhttp request msgIf-modified-since: http responseHTTP/1.1 200 OK

    object modified

  • URL

  • Uniform Resource Locator URL WebWebhttp://www.xjtu.edu.cn/index.htmURL URL

  • http:// ftp:// gopher:// telnet:// news: mailto:

  • jpg/

  • /

  • ()

  • *URLURLWebBookmarkHotlist)Web

  • Web Caches (proxy server)web cachewebhttp requestsweb cacheweb cacheweb cacheweb cacheclientProxyserverclienthttp requesthttp requesthttp responsehttp responsehttp requesthttp responseorigin server

  • HTML HTMLHypertext Markup Language(tag)HTML(element)(start tag)(end tag)

  • HTMLHTML HTMLHTML(DHTMLASPPHPJAVA Script)HTML

  • HTML Test

  • HTML

    HTML

    Describing the appearance and contents of a page

  • HTML ()

    rosessunflowersdaffodils

  • HTML ()

    I am having funAre you having fun too?

    applesorangesmangoes

  • JanuaryFebruaryMarch 12562957256

  • HTMLHEADBODYHTMLHTML.htm.html HEAD BODYHTML

  • HTML

  • *4.6 loss tolerant:Streaming stored audio and video Streaming live audio and videoReal-time interactive video

  • Streaming stored MM (VCR: pause, resume, fast forward, rewind, etc.): 110Unidirectional Real-Time: Interactive Real-Time :Video: < 150 msec acceptableAudio: < 150 msec good,
  • TCP/UDP/IP(best-effort service) 5-10Real-Time Interactive packet jitter

  • Streaming Stored Audio & VideoStreaming stored media:Audio/video audio/videoAudio/video Media player:

  • Streaming from Web server (1)AudiovideoWeb server HTTP Web serverHTTP content-type header line audio/videoBmedia playermedia playermedia player : Web

  • Streaming from Web server (2) Web meta file Content-type header audio/video TCPHTTP Some concernsHTTPUDP

  • Streaming from a streaming serverHTTPTCP/UDP

  • TelnetFTPE-mialWWW*

    ***************************************************************************************************