Intro to Sockets
- This is chapter 58
- An internetwork or internet connects different computer networks allowing hosts to communicate with one another.
- A goal is to hide the details of different physical networks
- And present an unified architecture to all machines connected to the network.
- This includes a single address space
- TCP/IP is the dominate network protocol.
- A network protocol is a set of rules defining how information is transmitted across the network.
- These are frequently designed in a series of layers.
- Messages are sent down through the layers
- Across the network
- And back up the layers.
- Hillman is happy to explain all of this in 475.
-
- Each layer needs to know how to supply/receive messages from the lower layer
- And each layer wraps the information with what it needs to keep track of messages. (See page 1183)
- Data Link Layer
- Lowest level.
- Our programs don't need to worry about this layer.
- You will potentially travel across many different types of networks,
- But the hardware takes care of this for you.
- Error detection, transmission control, rebroadcast, ....
- Network Layer (IP)
- Concerned about packets
- Breaks the data in packets small enough for transmission
- Routes the data across the internet
- Communicates with transport layer
- IPV4 vs IPV6
- Datagrams
- Small packets of data
- A message may be composed of multiple datagrams
- Header information used to route and reassemble packets
- Connectionless and Unreliable
- Packets might not arrive in order.
- Packets might not arrive.
- IP Addresses
- In IPV4 it is a 32 bit number
- Generally written as nnn.nnn.nnn.nnn
- A network mask tells what part of the ip address is network and what part is machine.
- nnn.nnn.nnn.mmm/24 means the top 24 bits are network.
- Some addresses have a default meaning
- 127.0.0.1 is the local machine (loopbakc)
- Transport layer (TCP)
- Two main protocols
- UDP : User Datagram Protocol
- TCP : Transmission Control Protocol
- Port Numbers:
- Like mail boxes
- Some are pre-assigned (sort of) /etc/services
UDP
- Connectionless
- Does error checking
- unreliable
- Good for small (~500 byte) messages
- Faster, but at a cost of the above.
- TCP
- Does everything you want
- But at a price: speed.
- A connection is:
- A transport protocol
- A source ip address
- A source port number
- A destination ip address
- A destination port number
- RFC: Request for Comment