Socket

  • application process sends/receives messages to/from its socket (the socket is created by application)

Two socket types for two transport services:

  • UDP socket at host [IP@ (host), Port#(host)]
  • TCP socket [IP@ source, IP@ dest, Port# s, Port# d]
    • possible that two TCP sockets → OS chose everything the same, but the IP@ of the source is what tells them apart.

Addressing processes

  • to receive messages, processes must have identifier
  • host device interface has unique 32-bit IP address

Does IP address of host on which process runs suffice for identifying the process?

No, many app processes can be running on the same host.

  • identifier includes both IP address and port numbers associated with process on host.
  • Ex port numbers:
    • HTTP server: 80
    • Mail server: 25
  • To send HTTP message to gaia.cs.umass.edu web server:
    • IP address: 128.119.245.12
    • port number: 80

Multiplexing/demultiplexing at Transport Layer

How demultiplexing works

  • host receives IP datagrams
    • each datagram has source IP address, destination IP address
    • each datagram carries at most one transport-layer segment
    • each segment has source port number, destination port number
  • host uses IP addresses & port numbers to direct segment to appropriate socket (different for UDP and TCP)

Socket programming with TCP

Client must contact server

  • server process must first be running
  • server must have created socket (door) that welcomes client’s contact

Client contacts server by:

  • Creating TCP socket, specifying IP address, port number of server process
  • when client creates socket: client TCP establishes connection to server TCP

Connection-oriented demultiplexing

  • TCP socket identified by 4-tuple:
    • source IP address
    • source port number
    • dest IP address
    • dest port number
  • demux: receiver uses all four values (4-tuple) to direct segment to appropriate socket
  • server may support many simultaneous TCP sockets:
    • each socket identified by its own 4-tuple
    • each socket associated with a different connecting client

  • Three segments, all destined to IP address: B, dest port: 80 are demultiplexed to different sockets
  • trying to connect to server via TCP sockets
  • TCP socket: remembers the past → connection oriented

Summary

  • Multiplexing, demultiplexing: based on segment, datagram header field values
  • UDP: demultiplexing using destination port number (only)
  • TCP: demultiplexing using 4-tuple: source and destination IP addresses, and port numbers
  • Note: Multiplexing/demultiplexing happen at all layers!!!