Extras din curs
The Socket API
________________________________________
• Protocols do not typically specify API
• API defined by programming system
• Allows greatest flexibility - compatibility with different programming systems
• Socket API is a specific protocol API
o Originated with Berkeley BSD UNIX
o Now available on Windows 95 and Windows NT, Solaris, etc.
• Not defined as TCP/IP standard; de facto standard
________________________________________
Sockets and socket libraries
________________________________________
• BSD UNIX includes sockets as system calls
• Some systems have different API
o Adding sockets would require changing OS
o Added library procedures - socket library - instead
• Adds layer of software between application and operating system
o Enhances portability
o May hide native API altogether
Sockets and UNIX I/O
________________________________________
• Developed as extension to UNIX I/O system
• Uses same file descriptor address space (small integers)
• Based on open-read-write-close paradigm
o open - prepare a file for access
o read/write - access contents of file
o close - gracefully terminate use of file
• Open returns a file descriptor, which is used to identify the file to read/write/close
________________________________________
The socket API
________________________________________
• Socket programming more complex than file I/O
• Requires more parameters
o Addresses
o Protocol port numbers
o Type of protocol
o New semantics
• Two techniques
o Add parameters to existing I/O system calls
o Create new system calls
• Sockets use a collection of new system calls
Preview document
Conținut arhivă zip
- Sockets.doc