TCP/IP and sockets

Cards (19)

  • ATNL - Application, Transport, Network, Link
  • Transport/TCP/IP: the 'handler' - Tracks receipt validity and order, resending etc.
  • Network/IP: Deals with the routing
  • TCP and IP both add headers to the packets for the respectibe layers on the otherside
  • There are limited amount of sockets. Some are public service designated but eg. port 80 - HTTP is outdated due to HTTPS
  • MAC addresses are globally unique, permanent for each device/NIC
  • IP addresses are assigned by the network
  • ports/sockets are used so an application doesn't have to deal with coms that are irrelevant to it
  • IP class A: N.X.X.X - 16mil hosts (50% overall)
  • IP class B: N.N.X.X - 25% of all, 65k hosts
  • IP class C: N.N.N.X - 16+mil availble, only 254 hosts
  • Home broadband - uses reusable IP addresses from which the traffic is combined into one channel to the outside world, but these can only be used in local networks
  • Server socket - sets a socket on which to wait for some coms serverside
  • Use print streams and buffered readers to generate output and read input raw across sockets
  • Once server socket senses request, generate a socket connection based on the client socket (Socket object as ServerSocket.accept() in java)
  • The server will listen on a specific port. When a server is listening on a port it is bound to it. Only one server (or process) on a machine can be listening on a certain port.
    The client will connect to a machine via a client socket, which will specify the the port to send to (the same one).
  • Use threads to handle requests simultaneosly and not have to wait
  • Threads cause the typical expected side effects - race conditions, bad interleaving interactions
  • socket = IP and port#