中国高校课件下载中心 》 教学资源 》 大学文库

复旦大学:《计算机网络 Computer Networking》课程电子教案(PPT课件讲稿)04 Socket Programming

文档信息
资源类别:文库
文档格式:PPT
文档页数:39
文件大小:356KB
团购合买:点击进入团购
内容简介
• Motivation for sockets • What’s in a socket? • Working with socket • Concurrent network applications • Project 1
刷新页面文档预览

Socket Programming Computer Networks, Spring 2013

Socket Programming Computer Networks, Spring 2013

Lecture today Motivation for sockets ·What' s in a socket? Working with socket Concurrent network applications Project 1

Lecture Today • Motivation for sockets • What’s in a socket? • Working with socket • Concurrent network applications • Project 1

Wh' y Socket? How can I program a network application? Share data Send messages Finish course projects IPC -Interprocess Communication

Why Socket? • How can I program a network application? – Share data – Send messages – Finish course projects... • IPC - Interprocess Communication

Network Layering 7 Application Application pResentation Presentation 5 Session Session tRansport Transport 3 Network Network Network 2 Data link Data link Data link Physical Physical Physical

Network Layering Application Presentation Session Transport Network Data link 1 Physical 2 3 4 5 6 7 Network Data link Physical Application Presentation Session Transport Network Data link Physical

Network Layering Why layering 7 Application Application pResentation Presentation 5 Session Session tRansport Transport 3 Network Network Network 2 Data link Data link Data link Physical Physical Physical

Network Layering • Why layering? Application Presentation Session Transport Network Data link 1 Physical 2 3 4 5 6 7 Network Data link Physical Application Presentation Session Transport Network Data link Physical

Layering makes it Easier Application programmer Doesn t need to send ip packets Doesn 't need to send ethernet frames Doesnt need to know how TCP implements reliability Only need a way to pass the data down Socket is the api to access transport layer functions

Layering Makes it Easier • Application programmer – Doesn’t need to send IP packets – Doesn’t need to send Ethernet frames – Doesn’t need to know how TCP implements reliability • Only need a way to pass the data down – Socket is the API to access transport layer functions

What Lower Layer need to know? We pass the data down What else does the lower layer need to know?

What Lower Layer Need to Know? • We pass the data down. What else does the lower layer need to know?

What Lower Layer need to know? We pass the data down What else does the lower layer need to know? How to identify the destination process? Where to send the data?(Addressing What process gets the data when it is there? (Multiplexing)

What Lower Layer Need to Know? • We pass the data down. What else does the lower layer need to know? • How to identify the destination process? – Where to send the data? (Addressing) – What process gets the data when it is there? (Multiplexing)

Identify the Destination Addressing IP address hostname(resolve to iP address via dns · Multiplexing port Server socket address 208.216.181.15:80 Client socket address 128.2.194.242:3479 FTP Server (port 21) Client HttpseRver (1282194242:3479,208216181.15:80)4(port80) Connection socket pair Client host address Server host address 128.2.194.242 208.216.181.15

Identify the Destination Connection socket pair (128.2.194.242:3479, 208.216.181.15:80) HTTP Server (port 80) Client Client socket address 128.2.194.242:3479 Server socket address 208.216.181.15:80 Client host address 128.2.194.242 Server host address 208.216.181.15 FTP Server (port 21) • Addressing – IP address – hostname (resolve to IP address via DNS) • Multiplexing – port

Sockets How to use sockets Setup socket Where is the remote machine(ip address hostname What service gets the data(port) Send and receive Designed just like any other lyo in unix send--write recv-- read Close the socket

Sockets • How to use sockets – Setup socket • Where is the remote machine (IP address, hostname) • What service gets the data (port) – Send and Receive • Designed just like any other I/O in unix • send -- write • recv -- read – Close the socket

刷新页面下载完整文档
VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
相关文档