19 - The Socket Interface Socket API overview Socket system...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
The Socket Interface Socket API overview Socket system calls Example client and server programs
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Application Programming Interface The API is the interface that the application uses to communicate with transport protocol software - usually a set of functions or classes S ocket API is the de facto standard for TCP/ IP Originated on UNIX but now available for other operating systems (e.g., Windows)
Background image of page 2
Sockets and descriptors Application requests the operating system to create a socket systems returns descriptor - small integer application then specifies details such as transport protocol, protocol addresses, specify if client or server using further functions application then uses the descriptor as an argument to functions that “read” and “write” data application then closes the socket
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Server Client socket bind listen accept recv/send close socket connect send/recv close
Background image of page 4
Creating a socket First create a socket with descriptor = socket(protofamily,type,protocol) protofamily specifies the protocol family to be used, e.g., PF_INET or PF_APPLETALK type specifies the type of communication, e.g., SOCK-STREAM or SOCK_DGRAM protocol specifies a specific protocol Function close ( socket ) terminates a socket
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Binding a socket bind(socket,localaddr,addrlen) associates a socket with a protocol port number socket is a socket descriptor localaddr is a structure that contains a local address addrlen specifies the length of the address
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 19

19 - The Socket Interface Socket API overview Socket system...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online