文档介绍:Chapter 2: Socket Programming
Chapter goal:
Program interface to
protocol
Socket API
Socket programming model
哈工大计算机学院 work Application Development Socket Programming 1
Chapter 2: Socket Programming
Chapter goal:
Program interface to
protocol
Socket API
Socket programming model
哈工大计算机学院 work Application Development Socket Programming 2
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)
哈工大计算机学院 work Application Development Socket Programming 3
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
哈工大计算机学院 work Application Development Socket Programming 4
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
哈工大计算机学院 work Application Development Socket Programming 5
API functionality
API must support:
Allocate local resources munication
Specify local and munication endpoints
Initiate a connection (clien