文档介绍:works and s
《计算机网络与因特网》课件
林坤辉
PART work Applications
Chapter 3 The Socket Interface
Socket 接口
Introduction
The interface between an application and protocol software.
How an application uses protocol software munication.
Set of procedures that an application uses to e a client or a server, to contact a remote destination, or to transfer data.
Application Program Interface
Client and server application use transport protocols municate.
The interface an application uses when it interacts with transport protocol software is known as an Application Program Interface (API).
An API defines a set of operations that an application can perform when interacting with protocol software, the API determines the functionality that is available.
The Socket API
Although protocol standards allow operating system designers to choose an API, many have adopted the Socket API.
The Socket API is available for many operating systems.
The Socket API originated as part of the BSD Unix operating system.
The Socket API is a de facto standard.
munication And Unix I/O
An municates through a socket similar to the way the application transfers data to or from a file.
Unix uses an open-read-write-close paradigm for all I/o
补充: 1. Socket API与Unix
Unix是一个通用的交互式多用户分时操作系统。
Unix由AT&T 公司Bell实验室于1969年开发。
Unix 有两个主要的流派:System V 和 BSD
System V 由最初的AT&T Unix 演化而来。
BSD Unix 是由加州大学伯克利(Berkeley) 分校开发,其目标是提供一个具有复杂网络支持的开放系统。
TCP/IP 协议族也与Unix 的发展有很密切关系。
Socket API与Unix 操作系统关系非常密切。
UNIX系统的I/O命令集,其模式为打开一读/写一关闭(open-write-read-close)。
在一个用户进程进行I/O操作时,它首先调用“打开”获得对指定文件或设备的使用权,并返回称为文件描述符的整型数,以描述用户在打开的文件或设备上进行I/O操作的进程。
然后这个用户进程多次调用“读/写”以传输数据。
当所有的传输操作完成后,用户进程关闭调用,通知操作系统已经完成了对某对象的使用。