当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter2

资源类别:文库,文档格式:PDF,文档页数:62,文件大小:378.83KB,团购合买
Chapter 2: Socket Programming Chapter goal: a Program interface to rotocol Socket API Socket programming model
点击下载完整版文档(PDF)

Chapter 2: Socket Programming Chapter goal: a Program interface to rotocol Socket API Socket programming model 哈工大计算机学院李全龙 Network Application Development Socket Programming

哈工大计算机学院 李全龙 Network Application Development Socket Programming 1 Chapter 2: Socket Programming Chapter goal: „ Program interface to protocol „ Socket API „ Socket programming model

Chapter 2: Socket Programming Chapter goal: Program interface to protocol Socket API Socket programming model 哈工大计算机学院李全龙 Network Application Development Socket Programming 2

哈工大计算机学院 李全龙 Network Application Development Socket Programming 2 Chapter 2: Socket Programming Chapter goal: „ Program interface to protocol „ Socket API „ Socket programming model

Interacting with Protocol Software Client or server uses transport protocols Protocol software inside os Applications outside os Mechanism needed to bridge the two Called Application Program Interface (API) 哈工大计算机学院李全龙 Network Application Development Socket Programming 3

哈工大计算机学院 李全龙 Network Application Development Socket Programming 3 Interacting with Protocol Software „ Client or server uses transport protocols „ Protocol software inside OS „ Applications outside OS „ Mechanism needed to bridge the two „ Called Application Program Interface (API)

mosely specified protocol software interface TCP/IP protocol software is part of the computer' s system software TCP/IP was designed to operate in a multi-vendor environment TCP/IP does not define details of aPf The interface between TCP/IP and applications that use it has been loosely specified TCP/IP standards do not specify the details of how application software interfaces with TCP/IP protocol software hey only suggest the required functionality, and allow system designers to choose the details when creating an API 哈工大计算机学院李全龙 Network Application Development Socket Programming 4

哈工大计算机学院 李全龙 Network Application Development Socket Programming 4 Loosely specified protocol software interface „ TCP/IP protocol software is part of the computer’s system software. „ TCP/IP was designed to operate in a multi-vendor environment. „ TCP/IP does not define details of API „ The interface between TCP/IP and applications that use it has been loosely specified. „ TCP/IP standards do not specify the details of how application software interfaces with TCP/IP protocol software „ They only suggest the required functionality, and allow system designers to choose the details when creating an API

Advantages and disadvantages of Loose specification Advantages: Flexibility and tolerance Different os select own implementation Disadvantages: Designers can make the interface details different for each OS Less portable across machines In practice, only a few aPIs have been developed for use with TCP /IP Berkeley UNIX: socket interface, or sockets nAT&T, System V UNIX:工 Windows: windows sockets interface, WINSOCK 哈工大计算机学院李全龙 Network Application Development Socket Programming 5

哈工大计算机学院 李全龙 Network Application Development Socket Programming 5 Advantages and disadvantages of Loose specification „ Advantages: „ Flexibility and tolerance. „ Different OS select own implementation. „ Disadvantages: „ Designers can make the interface details different for each OS. „ Less portable across machines. „ In practice, only a few APIs have been developed for use with TCP/IP. „ Berkeley UNIX: socket interface, or sockets „ AT&T, System V UNIX: TLI „ Windows: windows sockets interface, WINSOCK

API functionality API must support Allocate local resources for communication Specify local and remote communication endpoints Initiate a connection( client side) Wait for a connection (server side) Send or receive data Determine when data arrives Generate urgent data Terminate a connection gracefully Handle connection termination from the remote site abort communication Handle error condition or a connection abort Release local resources when communication finishes 哈工大计算机学院李全龙 Network Application Development Socket Programming 6

哈工大计算机学院 李全龙 Network Application Development Socket Programming 6 API functionality „ API must support: „ Allocate local resources for communication „ Specify local and remote communication endpoints „ Initiate a connection (client side) „ Wait for a connection (server side) „ Send or receive data „ Determine when data arrives „ Generate urgent data „ Terminate a connection gracefully „ Handle connection termination from the remote site „ Abort communication „ Handle error condition or a connection abort „ Release local resources when communication finishes

Conceptual interface specification The TCP/IP standards do not leave implementors without any guidance They specify a conceptual interface: a set of procedures and functions The conceptual interface defined by tcp/Ip standards does not specify data representations or programming details It merely provides an example of one possible interface that an OS can offer to application programs that use TCP/IP 哈工大计算机学院李全龙 Network Application Development Socket Programming 7

哈工大计算机学院 李全龙 Network Application Development Socket Programming 7 Conceptual interface specification „ The TCP/IP standards do not leave implementors without any guidance. „ They specify a conceptual interface: a set of procedures and functions. „ The conceptual interface defined by TCP/IP standards does not specify data representations or programming details; „ It merely provides an example of one possible interface that an OS can offer to application programs that use TCP/IP

Implementation of an API All implementations of a particular API appear the same to programmers: the API merely consists of a set of procedures( or functions)that an application program can call to establish communication or send and receive data In practice, the implementation of the api depends on the under lying system Sharing API code might reside in the computer's OS or it might reside in a region of memory devoted to shared libraries Win95/ 98 uses a shared lib scheme known as Dynamic Linked Library (DLL) 哈工大计算机学院李全龙 Network Application Development Socket Programming 8

哈工大计算机学院 李全龙 Network Application Development Socket Programming 8 Implementation of an API „ All implementations of a particular API appear the same to programmers: the API merely consists of a set of procedures ( or functions) that an application program can call to establish communication or send and receive data. „ In practice, the implementation of the API depends on the underlying system. „ Sharing API code might reside in the computer’s OS, or it might reside in a region of memory devoted to shared libraries. „ Win95/98 uses a shared lib scheme known as Dynamic Linked Library (DLL)

Implementation of an API Win95/98 p)(4p ppn App programs DLL containing socket interface procedures Socket API DLL containing TCP /IP software -TCP/IP functions Operating system Functions I/O functions 哈工大计算机学院李全龙 Network Application Development Socket Programming 9

哈工大计算机学院 李全龙 Network Application Development Socket Programming 9 Implementation of an API „ Win95/98 : Operating System Functions DLL containing TCP/IP software DLL containing socket interface procedures App1 App2 Appn TCP/IP functions …… App programs Socket API I/O functions

Implementation of an API Windows nt/2000/XP uses a hybrid scheme that includes both a dll and resident code App2 App pp programs DLL containing socket interface procedures Socket api TCP/IP functions Operating System Functions and io functions 哈工大计算机学院李全龙 Network Application Development Socket Programming 10

哈工大计算机学院 李全龙 Network Application Development Socket Programming 10 Implementation of an API „ Windows NT/2000/XP uses a hybrid scheme that includes both a DLL and resident code. Operating System Functions DLL containing socket interface procedures App1 App2 …… Appn App programs Socket API TCP/IP functions and I/O functions

点击下载完整版文档(PDF)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共62页,可试读20页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有