1 / 71

Advanced Programming

Advanced Programming. Rabie A. Ramadan Rabie@rabieramadan.org. Network Programming An Overview. A computer network is an interconnected collection of autonomous computers. Computer Network.

Télécharger la présentation

Advanced Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced Programming Rabie A. Ramadan Rabie@rabieramadan.org

  2. Network Programming An Overview

  3. A computer networkis an interconnected collection of autonomous computers. Computer Network

  4. 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 messages travel Network topology

  5. 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.)

  6. 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.)

  7. 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.)

  8. 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.)

  9. 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.)

  10. 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.)

  11. 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.)

  12. 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.)

  13. 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.)

  14. Advantages and Disadvantages of Network Topologies Network topology (cont.)

  15. 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

  16. Repeaters are very simple devices. Allow a cabling system to extend beyond its maximum allowed length by amplifying the network voltages so they travel farther. Repeaters are nothing more than amplifiers and, as such, are very inexpensive. Network HardwareRepeaters

  17. Hubs are devices used to link several computers together. They repeat any signal that comes in on one port and copy it to the other ports (a process that is also called broadcasting). There are two types of hubs: active and passive. Passive hubssimply connect all ports together electrically and are usually not powered. Active hubs use electronics to amplify and clean up the signal before it is broadcast to the other ports. In the category of active hubs, there is also a class called “intelligent” hubs, which are hubs that can be remotely managed on the network. Network Hardware Hubs

  18. Network Hardware Hubs

  19. They join similar topologies and are used to divide network segments. For example, with 200 people on one Ethernet segment, the performance will be mediocre, because of the design of Ethernet and the number of workstations that are fighting to transmit. If you divide the segment into two segments of 100 workstations each, the traffic will be much lower on either side and performance will increase. They are more intelligent than repeaters but are unable to move data across multiple networks simultaneously. Unlike repeaters, bridges can filter out noise. The main disadvantage to bridges is that they can’t connect dissimilar network types or perform intelligent path selection. For that function, you would need a router. Network Hardware Bridges

  20. Network Hardware Bridges

  21. Routers are highly intelligent devices that connect multiple network types and determine the best path for sending data. The advantage of using a router over a bridge is that routers can determine the best path that data can take to get to its destination. Like bridges, they can segment large networks and can filter out noise. However, they are slower than bridges because they are more intelligent devices; Network Hardware Routers

  22. Just like a hub A network switch conserves network bandwidth and offers generally better performance than a hub. A vital differencebetween a hub and a switch is that all the nodes connected to a hub share the bandwidth among themselves, while a device connected to a switch port has the full bandwidthall to itself. For example, if 10 nodes are communicating using a hub on a 10-Mbps network, then each node may only get a portion of the 10 Mbps if other nodes on the hub want to communicate as well. . But with a switch, each node could possibly communicate at the full 10 Mbps. Network Hardware Switch

  23. Network Hardware Switch

  24. 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

  25. IP Addresses and Classes

  26. IP Addresses and Classes

  27. IP Addresses and Classes

  28. IP Addresses and Classes

  29. Subnet Mask

  30. A network architecture is 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

  31. ISO/OSI Reference Model

  32. 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

  33. TCP/IP Model

  34. Internet Model

  35. 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

  36. 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

  37. 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

  38. Establish contact (connection). Exchange information (bi-directional). Terminate contact. Basic Paradigm for Communication

  39. 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

  40. 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

  41. TCP (Transmission Control Protocol) is a connection-oriented protocol. UDP (User Datagram Protocol) is connectionless (UDP) protocol. TCP and UDP

  42. 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

  43. 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

  44. Sockets

  45. 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

  46. 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

  47. UDP Socket

  48. Types of Sockets A stream socket uses TCP for connection-oriented communication. It is also called a TCP socket. A datagram socket uses UDP for connectionless communication. It is also called a UDP socket. A raw socket uses IP directly. It is used in such applications as in ICMP protocol

  49. ICMP: Internet Control Message Protocol ICMP: Internet Control Message Protocol ICMP handles error and control information between gateways and hosts. The messages are transmitted using IP datagrams. They are normally generated and processed by the TCP/IP software itself, not user processes.

  50. Normally, a server would first listen and accept a connection and then fork a new process to communicate with the client. It uses the listen operation to listen for connections on a socket. int listen (intsockfd, int backlog) : - Sockfda socket descriptor created by the socket call. - The backlog parameter defines the maximum length the queue of pending connections may grow to. UNIX TCP Communication

More Related