Preliminaries
Winsock
Parts are identical to Berkeley sockets in Unix.
Initialization
- Should be done before other winsock calls.
- Once per program.
#include <Winsock2.h>
WSADATA wsaData;
WORD wVersionRequested = MAKEWORD(2,2);
if (WSAStartup(wVersionRequested, &wsaData) != 0)
{
printf("WSAStartup error %d\n", WSAGetLastError());
WSACleanup();
return;
}
Client
Steps for TCP:
- Open a socket
- Determine the IP address of the server in URL
- Check if host is IP address,
inet_addr(host)
- If not, do DNS lookup,
gethostbyname(host)
- Check if host is IP address,
- Initiate connection with the server, IP and port
- Convert port to network byte order
- Send request
- Receive response
- Until receive 0 byte.
- Close socket
Note that all numbers must be in network byte order (MSB first). Convert two-way using
- host to network,
htons()
,htonl()
- network to host,
ntohs()
,ntohl()
Introduction
Internet
Component:
- Edge: Hosts (end systems)
- Core
- Routers, forward packets
- Communication links
Internet standards:
- IETF, Internet Engineering Task Force
- RFC: Request for comments
The architecture is roughly hierarchical
- Center: tier-1 ISPs
- as backbone of the Internet
- interconnect at public NAPs (network access points)
- Level3, Sprint, AT&T, Verizon
- tier-2
- customers of tier-1
- tier-3 and local
Delay
4 sources:
- Router processing delay
- check bit error
- determine output link
- place packet in buffer
- queuing delay
- at output link
- depends on congestion level
- Transmission delay
- fire packet out (, packet length, link rate)
- Propagation delay
queuing delay increase exponentially as traffic rate approaches link bandwidth
Traceroute
traceroute
tracert
in windows
- Send 3 packets for each router along the path to destination.
- Routers return responses to the sender.
- Sender times intervals.
Packet loss
- Queues have finite capacity.
- Drop-tail queuing at routers
Protocol Stack
- Application
- interact with users
- FTP, SMTP, HTTP
- message
- Transport
- inter-process data transfer
- TCP, UDP
- segment
- Network
- routing of datagrams from source to destination host
- IP, routing protocols
- datagram
- Link
- data transfer between neighboring network elements
- Ethernet
- frame
- Physical
- bits on wire
Reference
This is my class notes while taking CSCE 612 at TAMU. Credit to the instructor Dr. Loguinov.