CSCE 515 Computer Network Programming Wenyuan Xu http
- Slides: 58
CSCE 515: Computer Network Programming Wenyuan Xu http: //www. cse. sc. edu/~wyxu/csce 515 f 07. html Department of Computer Science and Engineering University of South Carolina
Some terms LAN n WAN n MAN n 2007 CSCE 515 – Computer Network Programming
LAN - Local Area Network n connects computers that are physically close together ( < 1 mile). ¨ high speed ¨ multi-access n Technologies: ¨ Ethernet 10 Mbps, 100 Mbps ¨ Token Ring 16 Mbps ¨ FDDI 100 Mbps 2007 CSCE 515 – Computer Network Programming
WAN - Wide Area Network n connects computers that are physically far apart. “long-haul network”. ¨ typically slower than a LAN. ¨ typically less reliable than a LAN. ¨ point-to-point n Technologies: ¨ telephone lines ¨ Satellite communications 2007 CSCE 515 – Computer Network Programming
MAN - Metropolitan Area Network n Larger than a LAN and smaller than a WAN - example: campus-wide network - multi-access network n Technologies: ¨ coaxial cable ¨ microwave 2007 CSCE 515 – Computer Network Programming
IP – Network Layer
IP Datagrams n IP is the network layer ¨ packet delivery service (host-to-host). ¨ translation between different data-link protocols. 2007 CSCE 515 – Computer Network Programming
IP Datagram 1 byte VERS 1 byte HL Service Datagram ID TTL Protocol 1 byte Fragment Length FLAG Fragment Offset Header Checksum Source Address Destination Address Options (if any) Data 2007 1 byte CSCE 515 – Computer Network Programming
IP Addresses n IP addresses are not the same as the underlying data-link (MAC) addresses. WHY? n IP is a network layer - it must be capable of providing communication between hosts on different kinds of networks (different data-link implementations). n The address must include information about what network the receiving host is on. This is what makes routing feasible. 2007 CSCE 515 – Computer Network Programming
IP Addresses n n n IP addresses are logical addresses (not physical) 32 bits. Includes a network ID and a host ID. Every host must have a unique IP addresses are assigned by a central authority (American Registry for Internet Numbers for North America). ¨ http: //www. iana. org/ipaddress/ip-addresses. htm 2007 CSCE 515 – Computer Network Programming
The four formats of IP Addresses Class A 0 Net. ID B 10 Net. ID C 110 D 1110 8 bits 2007 Host. ID Net. ID Multicast Address 8 bits CSCE 515 – Computer Network Programming 8 bits
Class A 128 possible network IDs over 4 million host IDs per network ID Class B 16 K possible network IDs 64 K host IDs per network ID Class C over 2 million possible network IDs about 256 host IDs per network ID 2007 CSCE 515 – Computer Network Programming
Network and Host IDs n A Network ID is assigned to an organization by a global authority. n Host IDs are assigned locally by a system administrator. n Both the Network ID and the Host ID are used for routing. 2007 CSCE 515 – Computer Network Programming
IP Addresses are usually shown in dotted decimal notation: 1. 2. 3. 4 000000010 00000011 00000100 n cse. sc. edu is 129. 252. 138. 8 n 10000001 11111100 10001010 00001000 CSE has a class B network 2007 CSCE 515 – Computer Network Programming
Host and Network Addresses n A single network interface is assigned a single IP address called the host address. n A host may have multiple interfaces, and therefore multiple host addresses. n Hosts that share a network all have the same IP network address (the network ID). 2007 CSCE 515 – Computer Network Programming
Special IP addresses n An IP broadcast addresses has a host ID of all 1 s. n An IP address that has a host ID of all 0 s is called a network address and refers to an entire network. n localhost: 127. 0. 0. 1 2007 CSCE 515 – Computer Network Programming
Subnet Addresses n An organization can subdivide it’s host address space into groups called subnets. n The subnet ID is generally used to group hosts based on the physical network topology. 10 2007 Net. ID Subnet. ID Host. ID CSCE 515 – Computer Network Programming
Subnetting router Subnet 1 128. 213. 1. x 2007 Subnet 2 128. 213. 2. x CSCE 515 – Computer Network Programming Subnet 3 128. 213. 3. x
Subnetting Subnets can simplify routing. n IP subnet broadcasts have a host. ID of all 1 s. n It is possible to have a single wire network with multiple subnets? n 2007 CSCE 515 – Computer Network Programming
Subnet Mask How do we know how many bits are allocate for subnet ID, how many bits are allocated for host ID? n Example: subnet mask: 255. 0 n Question: what is the subnet id for 129. 252. 138. 8 if subnet is: n ¨ 255. 0 ¨ 255. 192 ¨ 255. 127. 0 2007 CSCE 515 – Computer Network Programming
IP Routing n 2007 Q: How do you get a packet from one network to another? CSCE 515 – Computer Network Programming
Mapping IP Addresses to Hardware Addresses IP Addresses are not recognized by hardware. n If we know the IP address of a host, how do we find out the hardware address ? n The process of finding the hardware address of a host given the IP address is called Address Resolution n 2007 CSCE 515 – Computer Network Programming
ARP n The Address Resolution Protocol is used by a sending host when it knows the IP address of the destination but needs the Ethernet (or whatever) address. n ARP is a broadcast protocol - every host on the network receives the request. n Each host checks the request against it’s IP address - the right one responds. 2007 CSCE 515 – Computer Network Programming
ARP conversation HEY - Everyone please listen! Will 128. 213. 1. 5 please send me his/her Ethernet address? not me Hi Green! I’m 128. 213. 1. 5, and my Ethernet address is 87: A 2: 15: 35: 02: C 3 2007 CSCE 515 – Computer Network Programming
Example: Proxy ARP 129. 252. 138. 0 H 1 H 2 H 3 H 4 H 5 H 6 E 1 E 2 E 3 E 4 E 5 E 6 129. 252. 138. 3 2007 129. 252. 138. 4 129. 252. 138. 6 CSCE 515 – Computer Network Programming
Reverse Address Resolution n The process of finding out the IP address of a host given a hardware address is called Reverse Address Resolution n Reverse address resolution is needed by diskless workstations when booting (which used to be quite common). 2007 CSCE 515 – Computer Network Programming
RARP conversation HEY - Everyone please listen! My Ethernet address is 22: BC: 66: 17: 01: 75. Does anyone know my IP address ? not me Hi Green! Your IP address is 128. 213. 1. 17. 2007 CSCE 515 – Computer Network Programming
Services provided by IP Connectionless Delivery (each datagram is treated individually). n Unreliable (delivery is not guaranteed). n Fragmentation / Reassembly (based on hardware MTU). n Routing. n Error detection. n 2007 CSCE 515 – Computer Network Programming
IP Datagram 1 byte VERS 1 byte HL Service Datagram ID TTL Protocol 1 byte Fragment Length FLAG Fragment Offset Header Checksum Source Address Destination Address Options (if any) Data 2007 1 byte CSCE 515 – Computer Network Programming
IP Datagram Fragmentation Each fragment (packet) has the same structure as the IP datagram. n IP specifies that datagram reassembly is done only at the destination (not on a hopby-hop basis). n If any of the fragments are lost - the entire datagram is discarded (and an ICMP message is sent to the sender). n 2007 CSCE 515 – Computer Network Programming
IP Flow Control & Error Detection If packets arrive too fast - the receiver discards excessive packets and sends an ICMP message to the sender (SOURCE QUENCH). n If an error is found (header checksum problem) the packet is discarded an ICMP message is sent to the sender. n 2007 CSCE 515 – Computer Network Programming
IP Datagram Fragmentation Each fragment (packet) has the same structure as the IP datagram. n IP specifies that datagram reassembly is done only at the destination (not on a hop-by-hop basis). n If any of the fragments are lost - the entire datagram is discarded (and an ICMP message is sent to the sender). n 2007 CSCE 515 – Computer Network Programming
IP Flow Control & Error Detection If packets arrive too fast - the receiver discards excessive packets and sends an ICMP message to the sender (SOURCE QUENCH). n If an error is found (header checksum problem) the packet is discarded an ICMP message is sent to the sender. n 2007 CSCE 515 – Computer Network Programming
ICMP Internet Control Message Protocol n n ICMP is a protocol used for exchanging control messages. Two main categories Query message ¨ Error message ¨ n n n Usage of an ICMP message is determined by type and code fields ICMP uses IP to deliver messages. ICMP messages are usually generated and processed by the IP software, not the user process. IP header ICMP Message 20 bytes 2007 CSCE 515 – Computer Network Programming
ICMP Message Format 0 78 type 15 16 code 31 checksum payload 2007 CSCE 515 – Computer Network Programming
ICMP Message Types Echo Request n Echo Response n Destination Unreachable n Redirect n Time Exceeded n there are more. . . n 2007 CSCE 515 – Computer Network Programming
ICMP Address Mask Request and Reply 0 78 type(17 or 18) 15 16 31 checksum code(0) identifier sequence number subnet mask 2007 CSCE 515 – Computer Network Programming
Transportation Layer
Transport Layer & TCP/IP Q: We know that IP is the network layer - so TCP must be the transport layer, right ? A: No… well, almost. TCP is only part of the TCP/IP transport layer - the other part is UDP (User Datagram Protocol). 2007 CSCE 515 – Computer Network Programming
Process TCP UDP ICMP, ARP & RARP IP 802. 3 2007 Process Layer Transport Layer Network Layer Data-Link Layer CSCE 515 – Computer Network Programming
UDP User Datagram Protocol n UDP is a transport protocol ¨ communication between processes UDP uses IP to deliver datagrams to the right host. n UDP uses ports to provide communication services to individual processes. n 2007 CSCE 515 – Computer Network Programming
Ports TCP/IP uses an abstract destination point called a protocol port. n Ports are identified by a positive integer. n Operating systems provide some mechanism that processes use to specify a port. n 2007 CSCE 515 – Computer Network Programming
Ports Host A 2007 Host B Process Process CSCE 515 – Computer Network Programming
UDP The term datagram is also used to describe the unit of transfer of UDP! Datagram Delivery n Connectionless n Unreliable n Minimal n UDP Datagram Format Source Port Destination Port Length Checksum Data 2007 CSCE 515 – Computer Network Programming
TCP Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. n TCP provides: ¨Connection-oriented ¨Reliable ¨Full-duplex ¨Byte-Stream n 2007 CSCE 515 – Computer Network Programming
Connection-Oriented Connection oriented means that a virtual connection is established before any user data is transferred. n If the connection cannot be established - the user program is notified (finds out). n If the connection is ever interrupted - the user program(s) is finds out there is a problem. n 2007 CSCE 515 – Computer Network Programming
Reliable does not mean that things don't go wrong, it means that we find out when things go wrong. Reliable means that every transmission of data is acknowledged by the receiver. n If the sender does not receive acknowledgement within a specified amount of time, the sender retransmits the data. n 2007 CSCE 515 – Computer Network Programming
Byte Stream n Stream means that the connection is treated as a stream of bytes. n The user application does not need to package data in individual datagrams (as with UDP). Somebody needs to do this since IP is delivering all the data, it's just that the application layer doesn't need to do this! 2007 CSCE 515 – Computer Network Programming
Buffering n TCP is responsible for buffering data and determining when it is time to send a datagram. n It is possible for an application to tell TCP to send the data it has buffered without waiting for a buffer to fill up. 2007 CSCE 515 – Computer Network Programming
Full Duplex n TCP provides transfer in both directions (over a single virtual connection). n To the application program these appear as 2 unrelated data streams, although TCP can piggyback control and data communication by providing control information (such as an ACK) along with user data. 2007 CSCE 515 – Computer Network Programming
TCP Ports n Interprocess communication via TCP is achieved with the use of ports (just like UDP). n UDP ports have no relation to TCP ports (different name spaces). 2007 CSCE 515 – Computer Network Programming
IP Demultiplexing TCP ICMP UDP IGMP IP VERS HL Service Fragment Length Datagram ID TTL FLAG Protocol Fragment Offset Header Checksum Source Address Destination Address Options (if any) Data 2007 CSCE 515 – Computer Network Programming
TCP Segments n The chunk of data that TCP asks IP to deliver is called a TCP segment. n Each segment contains: ¨ data bytes from the byte stream ¨ control information that identifies the data bytes 2007 CSCE 515 – Computer Network Programming
TCP Segment Format 0 15 16 source port number 31 destination port number sequence number acknowledgment number header length reserved U A P R S F R C S S Y I G K H T N N TCP checksum window size urgent pointer option (if any) data (if any) 2007 CSCE 515 – Computer Network Programming 20 bytes
Addressing in TCP/IP n Each TCP/IP address includes: ¨ Internet Address ¨ Protocol (UDP or TCP) ¨ Port Number NOTE: TCP/IP is a protocol suite that includes IP, TCP and UDP. 2007 CSCE 515 – Computer Network Programming
TCP vs. UDP Q: Which protocol is better ? A: It depends on the application. TCP provides a connection-oriented, reliable, byte stream service (lots of overhead). UDP offers minimal datagram delivery service (as little overhead as possible). 2007 CSCE 515 – Computer Network Programming
TCP/IP Summary n IP: network layer protocol ¨ unreliable hosts. n UDP: transport layer protocol ¨ n unreliable datagram delivery between processes. TCP: transport layer protocol ¨ 2007 datagram delivery between reliable, byte-stream delivery between processes. CSCE 515 – Computer Network Programming
Hmmmmm. TCP or UDP ? Electronic commerce? n Video server? n File transfer? n Email ? n Chat groups? n Robotic surgery controlled remotely over a network? n 2007 CSCE 515 – Computer Network Programming
- Dai yuqiang
- Wenyuan xu
- Network topologies
- 515 sda hymnal
- Encm 515
- Encm 515
- Encm 515
- Mse data science
- Ieee 515
- Free space propagation model in wireless communication
- Mit 1025
- 515 west hastings street
- Encm 517
- Nnaudio
- A sound wave produced by a clock chime is heard 515
- Encm 515
- Round off of 56
- Encm 515
- Pix
- Perbedaan linear programming dan integer programming
- Greedy vs dynamic
- System programming
- Linear vs integer programming
- Programing adalah
- Http //mbs.meb.gov.tr/ http //www.alantercihleri.com
- Siat.ung.ac.id
- Tcp echo client server
- Socketaddr_in
- Android network programming
- Network model linear programming
- Unix network programming stevens
- Inter process communication java
- Python
- File and record locking in network programming
- Stevens unix
- Nocti computer programming study guide
- Nano programming in coa
- Concepts, techniques, and models of computer programming
- Language
- American computer science league practice problems
- Types of variables in computer programming
- Programming raster display system in computer graphics
- Computerite
- Computer programming chapter 1
- What is part programming
- Discrete mathematics with applications fourth edition
- Computer programming chapter 1
- History of python
- Computer programming with matlab
- Linear programming models graphical and computer methods
- Decision making in computer programming
- Cir and cil are symbols of _________.
- Programming fundamentals 1
- Python programming an introduction to computer science
- Csce 221 tamu
- Csce 314
- Csce 314
- Csce 314
- Csce 314 tamu