Topic 2
Topic 2
(a) Point-to-point
(b) Multiple access
Connectivity
Terminologies (contd.)
Cloud
Hosts
(a)
Switches
internetwork
Router/gateway
Host-to-host connectivity
Address
Routing
Unicast/broadcast/multicast
(b)
The transport layer and the higher layers typically run only on end-
hosts and not on the intermediate switches and routers
Internet Architecture
Socket Type
SOCK_STREAM is used to denote a byte stream
SOCK_DGRAM is an alternative that denotes a
message oriented service, such as that provided by
UDP
Creating a Socket
int sockfd = socket(address_family, type, protocol);
Server invokes
int bind (int socket, struct sockaddr *address,
int addr_len)
int listen (int socket, int backlog)
int accept (int socket, struct sockaddr *address,
int *addr_len)
Client-Serve Model with TCP
Bind
Binds the newly created socket to the specified address i.e. the
network address of the local participant (the server)
Address is a data structure which combines IP and port
Listen
Defines how many connections can be pending on the specified
socket
Client-Serve Model with TCP
Accept
Carries out the passive open
Blocking operation
Does not return until a remote participant has established a
connection
When it does, it returns a new socket that corresponds to the
new established connection and the address argument
contains the remote participant’s address
Client-Serve Model with TCP
Client
Application performs active open
It says who it wants to communicate with
Client invokes
int connect (int socket, struct sockaddr *address,
int addr_len)
Connect
Does not return until TCP has successfully established a
connection at which application is free to begin sending data
Address contains remote machine’s address
Client-Serve Model with TCP
In practice
The client usually specifies only remote participant’s
address and let’s the system fill in the local
information
Whereas a server usually listens for messages on a
well-known port
A client does not care which port it uses for itself, the
OS simply selects an unused one
Client-Serve Model with TCP
int main()
{
struct sockaddr_in sin;
char buf[MAX_LINE];
int len;
int s, new_s;
/* build address data structure */
bzero((char *)&sin, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons(SERVER_PORT);
Network as a pipe
Delay X Bandwidth
Relative importance of bandwidth and latency
depends on application
For large file transfer, bandwidth is critical
For small messages (HTTP, NFS, etc.), latency is
critical
Variance in latency (jitter) can also affect some
applications (e.g., audio/video conferencing)
Delay X Bandwidth
How many bits the sender must transmit
before the first bit arrives at the receiver if the
sender keeps the pipe full
Takes another one-way latency to receive a
response from the receiver
If the sender does not fill the pipe—send a
whole delay × bandwidth product’s worth of
data before it stops to wait for a signal—the
sender will not fully utilize the network
Delay X Bandwidth
Infinite bandwidth
RTT dominates
Throughput = TransferSize / TransferTime
TransferTime = RTT + 1/Bandwidth x
TransferSize
Its all relative
1-MB file to 1-Gbps link looks like a 1-KB
packet to 1-Mbps link
Relationship between bandwidth and latency