Client-Server Architecture, WANs, Internetworking, and Web Services

Lecture 4 – Client/Server and Sockets

Client-Server: Provides high-level functionality that users access. They use the transport mechanism provided by a network (such as the internet). They are identified by high-level names, while low-level details are hidden. They provide functions for exposing, accessing, and using services.

Single Server Multiple Services: Makes better use of CPU cycles and reduces the cost of additional server overhead. When there are multiple services on a single server, they need to be identified individually.

Identifying Services: Must be unambiguous. Each service has a unique ID used by both the server and clients. Services are registered via server protocols. The server registers the service with the local protocol implementation and defines the ID for the offered service. This is used by the transport protocol by the client to request the service and on the server to route the request to the correct program. This ID is the IP address and port, which identifies the machine hosting the service. The port is an integer in the range of 0 to 65535. The program binds to the port and listens to protocols, typically defining a default port to use.

Sockets: A socket is an endpoint for communication. Typically, the file I/O functions are used with sockets; read() and write(). A server socket listens for a connection request from a client. A client socket connects to a server socket.

Socket Types: Two widely used types are Datagram sockets and Stream sockets.

  • Datagram sockets – communication treated as a sequence of discrete messages; built on UDP (User Datagram Protocol).
  • Stream sockets – communication treated as a continuous stream of characters; built on TCP (Transmission Control Protocol); has the concept of a ‘Connection’.

Comparison – Streams and Datagrams:

  • Stream sockets: TCP – Detects lost messages and transparently retransmits; breaks messages up as required; use read() and write() in C.
  • Datagram sockets: UDP – Have no error handling; provide messages of exactly the sent size; use sendto() and receivefrom() in C; Involve less overhead; often used for short-message comms.

socketsIP Address: Identifies computer on IP network (Layer 3). IPv4 is 32-bit, unique to a network, composed of physical network and computer within network. IPv6 is similar but 128-bit. IPV4: Large network IDs limit no. computers on network while small network IDs limit no. networks, but allow many computers. There are 5 classes of addresses: A: 8-bits, B: 16-bits, C: 24-bits, D: Multicast, E: Unused. Ports: A layer 4 concept (used with TCP/IP & UDP/IP). Allows end-to-end communication between two hosts. Port number is an identifier. Allows traffic sent to one host be identified for specific program. Ports below 1024 are reserved for ‘well-defined’ services. Hubs and Switches: Central connection points for networked devices. Transmits frames to/from connected devices. A hub is a layer 1 device that does not understand frames. Sends frame to all connected devices in hopes that one of them will be the recipient; or know how to send to the recipient. Switches are a layer 2 device that understands frames and MAC addresses. Sends frames to the correct device by using the MAC address as identification. Routing Tables: Route packets (Layer 3) to destinations. Typically connects two or more networks. Routers maintain routing tables so they know where to send packets. If the router is not directly connected to the destination node, then they send it to a node that knows the next step. Routing tables need to be maintained. Static routing uses predefined tables of ‘forwarding addresses’ that do not update over time. Dynamic routing builds tables of forwarding addresses that are updated periodically; this is done via the Routing Information Protocol (RIP). Identifies the weight of a transmission such as speed/time. Routing Loops: Packets may continually be routed between two or more routers. This occurs due to invalid/inconsistent routing tables; usually due to slow convergence/updates of routes. Can be mitigated with maximum hop counts, and smart routing protocols. Sockets: Network communication endpoints. Abstracts IO to appear as file IO. Write data to socket – transmits data over network. Reads data from socket – reads data sent over network. Two modes of operation: server sockets – listens for and accepts connection requests; client sockets – transmits and receives data transmitted over network. Stream Sockets: Communication is a continual stream of data sent over a network. Built on TCP (Transmission Control Protocol). Detects lost messages. Messages sent in fixed sized units. Datagram Sockets: Communication is treated as a sequence of discrete messages. Built on UDP (User Datagram Protocol). No guarantee of data sent in order. Messages can be lost. Messages in fixed size. Web Services: Services offered over the web. Typically based on many technologies, commonly SOAP, WSDL, UDDI. Good implementations abstract all network programming. WSDL: Web Service Definition Language. Defines procedures, parameters, responses exposed by a web service.  SOAP: Simple Object Access Protocol. Document used to invoke a web service and return a response from a web service. Standard implementations operate over HTTP(S).


Review – Part 2

NAPT: Network Address and Port Translation. Allows multiple hosts to be hidden behind one public host. Maps traffic for internal IP address and port to public IP address and port. VPN: Virtual Private Network. Extends a private network between two remote locations. Uses public networks as a ‘bridge’ or medium transmission. Allows remote computers connected to internet to appear to be on a private network. Allows two distinct private networks to communicate over a public network. Is secure as data transmitted is encrypted across public network.  VPN vs NAPT: There is a relationship between what routers do for VPN and NAT. Both sit on the boundary between private and public internets. Both manipulate IP datagrams as they cross that boundary. For VPN -encryption/decryption/encapsulation. For NAT – header address/port id translation. DHCP: Dynamic Host Configuration Protocol. Protocol to automate IP address assignment. Allows host to obtain IP address automatically (may change over time). Allows joining to network without any IP address configuration. DHCP server is assigned a pool of IP addresses – allocates addresses to requesting clients. Clients ‘lease’ an IP address; address returned to the pool after lease expires.

vpn

tcp

encap


Subnet MaskBinary FormatDecimal Format
Class A8-bit11111111.00000000.00000000.00000000255.0.0.0
Class B16-bit11111111.11111111.00000000.00000000255.255.0.0
Class C24-bit11111111.11111111.11111111.00000000255.255.255.0

crc demo

  routing table