正在加载图片...
Chapter 2: Socket Programming Chapter 2: Socket Programming Chapter goal Chapter goal: Program interface to Program interface to protocol tocol Socket API a Socket API Socket programming model Socket programming model Interacting with Protocol Loosely specified protocol Software software interface a Client or server uses transp TCP/IP protocol software is part of the protocols computers system sof two TCP/IP was designed to operate in a multi-vendor Protocol software inside oS environment Applications outside OS TCP/iP does not define details of API TCP/ IP andφp Mechanism needed to bridge the two that use it has been Called Application Program Interface application software interfaces wit (API) They only suggest the required functionality, and allow an aPI gners to choose the details when creating Advantages and disadvantages of Loose specification API functionality Advantages API must support Different OS select own implementation. Disadvantage Designers can make the interface details Vait for a connection(server Less portable across machine In practice, only a few APIs have developed for use with TCP/IP. Berkeley UNTX: socket interface, or bort communication AT&T, System V UNIX: TLI Release local resources when communication finishes Windows: windows sockets interface WINSOCK1 哈工大计算机学院 李全龙 Network Application Development Socket Programming 1 Chapter 2: Socket Programming Chapter goal: „ Program interface to protocol „ Socket API „ Socket programming model 哈工大计算机学院 李全龙 Network Application Development Socket Programming 2 Chapter 2: Socket Programming Chapter goal: „ Program interface to protocol „ Socket API „ Socket programming model 哈工大计算机学院 李全龙 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) 哈工大计算机学院 李全龙 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 哈工大计算机学院 李全龙 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 哈工大计算机学院 李全龙 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
向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有