Professional Documents
Culture Documents
Jan 2005
Definition
The services provided (often by the operating
system) that provide the interface between
application and protocol software.
Application
Network API
Protocol A Protocol B
Protocol C
Functions
Define an end- point for
communication
Initiate and accept a connection
Send and receive data
Terminate a connection gracefully
Examples
File transfer apps (FTP), Web browsers
(HTTP), Email (SMTP/ POP3), etc
Types of Sockets
Two different types of sockets :
stream vs. datagram
Addressing
Client
Server
socket()
TCP Server
TCP Client
listen()
Socket()
accept()
Connection establishment blocks until connection from client
connect()
Data(request)
write()
read()
process request
read()
close()
Data(reply)
End-of-fle n
otifcation
write()
read()
close()