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

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
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter2-6.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter1new.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter1new-6.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter1.pdf
- 陕西国防学院:《电子商务概论》第十章 电子商务系统的建设.pps
- 陕西国防学院:《电子商务概论》第六章 网络营销.pps
- 陕西国防学院:《电子商务概论》第九章 电子商务安全.pps
- 陕西国防学院:《电子商务概论》第八章 电子商务的法律规范.pps
- 陕西国防学院:《电子商务概论》第四章 电子商务支付系统.pps
- 陕西国防学院:《电子商务概论》第七章 电子商务在其他领域的应用.pps
- 陕西国防学院:《电子商务概论》第一章 电子商务概述.pps
- 陕西国防学院:《电子商务概论》第三章 电子商务的应用框架与交易模式.pps
- 陕西国防学院:《电子商务概论》第五章 物流管理.pps
- 陕西国防学院:《电子商务概论》第二章 网络技术基础.pps
- 陕西国防学院:《电子商务概论》序言.pps
- 《计算机软件技术基础》ppt电子课件.ppt
- 《Microsoft Project 2002 教学手册》讲义.pdf
- 《高级软件工程》学习资料(英文版)Software System Safety.pdf
- 《高级软件工程》学习资料(英文版)Programming Languages.pdf
- 《高级软件工程》学习资料(英文版)types of Characteristics.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter3-6.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter3.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter4-6.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter4.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter5-6.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter5.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter6-6.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter6.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter7-6.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 NAD-chapter7.pdf
- 哈尔滨工业大学:《网络应用开发》英文版 网络开发与应用实验指导书.pdf
- 台北科技大学:《计算机网络》(英文版) NP04 0 Network Programming.ppt
- 台北科技大学:《计算机网络》(英文版) NP04 1 CONTENTS.ppt
- 台北科技大学:《计算机网络》(英文版) NP04 11 Introduction.ppt
- 台北科技大学:《计算机网络》(英文版) NP04 12 CONTENTS.ppt
- 台北科技大学:《计算机网络》(英文版) NP04 15 Client Server model.ppt
- 台北科技大学:《计算机网络》(英文版) NP04 16 Socket API.ppt
- 台北科技大学:《计算机网络》(英文版) NP04 16 Client Software Design.ppt
- 台北科技大学:《计算机网络》(英文版) NP04 16 multi proto.ppt
- 台北科技大学:《计算机网络》(英文版) NP04 16 multi services.ppt