950 likes | 1.15k Views
Advanced Programming. Rabie A. Ramadan Lecture 3. Network Programming An Overview. A computer network is an interconnected collection of autonomous computers. Computer Network. A topology is a way of “ laying out” the network. Topologies can be either physical or logical .
E N D
Advanced Programming Rabie A. Ramadan Lecture 3
A computer networkis an interconnected collection of autonomous computers. Computer Network
A topologyis a way of “laying out” the network. Topologies can be either physical or logical. Physical topologies describe how the cables are run. Logical topologies describe how the network messagestravel Network topology
Bus (can be both logical and physical) Star (physical only) Ring (can be both logical and physical) Mesh (can be both logical and physical) Network topology (cont.)
Bus A bus is the simplest physical topology. It consists of a single cable that runs to every workstation This topology uses the least amount of cabling, but also covers the shortest amount of distance. Network topology (cont.)
It is difficult to add a workstation Have to completely reroute the cable and possibly run two additional lengths of it. If any one of the cables breaks, the entire network is disrupted. Therefore, it is very expensive to maintain. Network topology (cont.)
Star Topology A physical star topology branches each network device off a central device called a hub, making it very easy to add a new workstation. Also, if any workstation goes down it does not affect the entire network. Network topology (cont.)
Star topologies are more expensive to install than bus networks, There are several more cables that need to be installed, plus the cost of the hubs that are needed. Network topology (cont.)
Ring Each computer connects to two other computers, joining them in a circle creating a unidirectional path where messages move workstation to workstation. Network topology (cont.)
The ring makes it difficult to add new computers. Unlike a star topology network, the ring topology network will go down if one entity is removed from the ring. Physical ring topology systems don’t exist much anymore, mainly because the hardware involved was fairly expensive and the fault tolerance was very low. Network topology (cont.)
Mesh The mesh topology is the simplest logical topology in terms of data flow, but it is the most complex in terms of physical design. In this physical topology, each device is connected to every other device Network topology (cont.)
The physical mesh topology is very expensive to install and maintain. Cables must be run from each device to every other device. The advantage you gain from it is its high fault tolerance. There will alwaysbe a way of getting the data from source to destination. Network topology (cont.)
Advantages and Disadvantages of Network Topologies Network topology (cont.)
A network includes: Special purpose hardware devices that: Interconnect transmission media Control transmission of data Run protocol software Protocol software that: Encodes and formats data Detects and corrects problems encountered during transmission Computer Network
Address: byte-string that identifies a node usually unique Routing: process of forwarding messages to the destination node based on its address Types of addresses unicast: node-specific broadcast: all nodes on the network multicast: some subset of nodes on the network Addressing and Routing
IP Addresses and Classes IPv6 addresses have a size of 128 bits
A network architectureis a set of layers and protocols used to reduce network design complexity. The TCP/IP Protocol Suite (also called the Internet Architecture) is an important example of a network architecture. The OSI (Open Systems Interconnection) 7-Layer Reference Model [ISO,1984] is a guide that specifies what each layer should do, but not how each layer is implemented. Network Architecture
ISO 7-Layer Reference Model End host End host Application Application Presentation Presentation Session Session Transport Transport Network Network Network Network Data link Data link Data link Data link Physical Physical Physical Physical One or more nodes within the network
A protocol is a set of rules of communication. Protocols are the building blocks of a network architecture. Term “protocol” is overloaded specification of peer-to-peer interface module that implements this interface Protocols
A network allows arbitrary applications to communicate. However, a network programmer doesn’t need to know the details of all lower-level network technologies. Network facilities are accessed through an Application Programming Interface (API); e.g., a Service Interface. Network Programming
Most network applications can be divided into two pieces: a client and a server. A Web browser (a client) communicate with a Web server. A Telnet client that we use to log in to a remote host. A user who needs access to data located at remote server. Basic Paradigm for Communication
Establish contact (connection). Exchange information (bi-directional). Terminate contact. Basic Paradigm for Communication
Server waits for client to request a connection. Client contacts server to establish a connection. Client sends request. Server sends reply. Client and/or server terminate connection. Client-Server Paradigm
Connection-oriented Setup the link before communication. Similar to the phone call. We need the phone number and receiver. Connectionless No link needed to be set up before communication. Similar to send a letter. We need the address and receiver. Two types of Communication
TCP (Transmission Control Protocol) is a connection-oriented protocol. UDP (User Datagram Protocol) is connectionless (UDP) protocol. TCP and UDP
Identifying the ultimate destination IP addresses identify hosts Host has many applications Ports (16-bit identifier) Ports Application WWW E-mail Telnet Port 80 25 23 192.18.22.13
A socket is defined as an endpoint for communication. Concatenation of IP address and port A socket pair (local IP address, local port, foreign IP address, foreign port) uniquely identifies a communication. The socket 161.25.19.8:1625 refers to port 1625 on host 161.25.19.8 Sockets
agreed port any port socket socket message client server other ports Internet address = 138.37.94.248 Internet address = 138.37.88.249 Sockets and Ports
TCP Socket Bind() binds the socket to the specified address. The address parameter specifies the local component of the address, e.g. IP address and UDP/TCP port
Steps in creating Clients in Java What is the difference between String and BufferedReader?