COMPUTER NETWORK PROGRAMMING - (Python Network...
Transcript of COMPUTER NETWORK PROGRAMMING - (Python Network...
![Page 1: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/1.jpg)
COMPUTER NETWORK PROGRAMMING(Python Network Programming)
Dr.Edi Surya Negara,M.Kom.
Postgraduate Program, Informatics Engineering (S2)
December 20, 2017
![Page 2: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/2.jpg)
References :
• Computer Networks - A Tanenbaum - 5th edition (2011)
• Data Communications and Networking - Behrouz A.Forouzan -4th edition (2007)
• Cisco System Inc - 2011 - Cisco Configuration Profesional UserGuide.
• Python Network Programming - David M Beazley (2010)
![Page 3: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/3.jpg)
Chapter 7: Objectives
This course focuses on the essential details of network programmingthat all Python programmers should probably know, students will beable to:
• Low-level programming with sockets.
• High-level client modules.
• How to deal with common data encodings.
• Simple Server & Client A : Basics.
![Page 4: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/4.jpg)
Computer Network Programming
• Computer network programming involves writing computerprograms that enable processes to communicate with each otheracross a computer network.
• Network programming is a major use of Python and C/C++
![Page 5: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/5.jpg)
Python Network Programming
• Python standard library has wide support for network protocols,data encoding/decoding, and other things you need to make itwork (sockets).
• Python provides two levels of access to network services. At a lowlevel, you can access the basic socket support in the underlyingoperating system, which allows you to implement clients andservers for both connection-oriented and connectionless protocols.
• Python also has libraries that provide higher-level access tospecific application-level network protocols, such as FTP, HTTP,and so on.
![Page 6: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/6.jpg)
Sockets
• Sockets are the endpoints of a bidirectional communicationschannel. Sockets may communicate within a process, betweenprocesses on the same machine, or between processes on differentcontinents.
![Page 7: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/7.jpg)
Sockets
• Programming abstraction for network code.
• Socket: A communication endpoint.
• Supported by socket library module.
• Allows connections to be made and data to be transmitted ineither direction.
![Page 8: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/8.jpg)
Sockets Basic
![Page 9: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/9.jpg)
The Promblem
• Communication between computers.
• It’s just sending/receiving bits.
![Page 10: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/10.jpg)
Sockets Basic
![Page 11: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/11.jpg)
Two Main Issues• Addressing.
• Specifying a remote computer and service.• Machines have a hostname and IP address.• Programs/services have port numbers
• Data transport. Moving bits back and forth.
![Page 12: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/12.jpg)
Data Transport
• There are two basic types of communication.
• Streams (TCP): Computers establish a connection with eachother and read/write data in a continuous stream of bytes—like ale. This is the most common.
• Datagrams (UDP): Computers send discrete packets (ormessages) to each other. Each packet contains a collection ofbytes, but each packet is separate and self-contained.
![Page 13: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/13.jpg)
TCP Server.py
![Page 14: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/14.jpg)
TCP Client.py
![Page 15: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/15.jpg)
![Page 16: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/16.jpg)
![Page 17: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/17.jpg)
![Page 18: COMPUTER NETWORK PROGRAMMING - (Python Network …eprints.binadarma.ac.id/3608/1/Chapter_Python_Network... · 2018-01-13 · Chapter 7: Objectives This course focuses on the essential](https://reader033.fdocuments.us/reader033/viewer/2022042520/5f448a3e8c76ff39f5100a3f/html5/thumbnails/18.jpg)