18
COMPUTER NETWORK PROGRAMMING (Python Network Programming) Dr.Edi Surya Negara,M.Kom. Postgraduate Program, Informatics Engineering (S2) December 20, 2017

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

  • Upload
    others

  • View
    23

  • Download
    0

Embed Size (px)

Citation preview

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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