SlideShare uma empresa Scribd logo
1 de 17
Python Network
Programming
Produced by Tae Young Lee
Contents
• Printing your machine's name and IPv4
address
• Retrieving a remote machine's IP address
• Converting an IPv4 address to dierent
formats
• Finding a service name, given the port and
protocol
• Converting integers to and from host to
network byte order
Printing your machine's name and
IPv4 address
C:UsersUser>python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> host_name = socket.gethostname()
>>> print "Host name : %s" %host_name
Host name : 이태영-PC
>>> print "IP address : %s" %socket.gethostbyname(host_name)
IP address : 169.254.236.217
Quiz 1
• 자신의 PC 이름과 IPv4 address를 출력할
함수를 만들어 구현하기
정답
Retrieving a remote machine's IP
address
• https://docs.python.org/3/library/socket.h
tml
• built-in library function
– gethostbyname()
Remote machine’s IP
Quiz 2
• Remote machine의 IP주소를 가져올 수 있
는 함수 구현하기
HINT
정답
Converting an IPv4 address to
dierent formats
• 파이썬 소켓 라이브러리는 다양한 IP 주소 형식을
다루는 유틸리티가 있습니다.
• 우리가 두 가지 사용 :
– inet_aton ()
– inet_ntoa ()
• convert_ip4_address () 함수, inet_aton을 만들어 보자
• inet_ntoa ()는 IP 주소 변환을 위해 사용된다.
• 우리는 두 개의 샘플 IP를 사용합니다
– 주소, 127.0.0.1과 192.168.0.1.
정답
Finding a service name, given the
port and protocol
우리가 find_service_name () 함수를 정의
• 여기서 getservbyport를 () 소켓 클래스 함수
는, (25)는, 예를 들면, 몇 개의 포트 (80)를 호
출
• 포트에 대한 서비스를 찾기 위한 함수를 구현
한다.
정답
Converting integers to and from
host to network byte order
• 파이썬의 소켓 라이브러리는 바이트 순서와
그 반대를 호스팅하는 네트워크 바이트 순서
로 변환하는 유틸리티가 있습니다.
• ntohl () / htonl() 함수를 사용
• ntohl () / htonl () 소켓 클래스 함수는 IP 어
드레스 포맷을 변환하기 위해 사용
• convert_integer () 함수를 정의하자.
정답

Mais conteúdo relacionado

Mais procurados

네트워크 스터디(Tcp 소켓 프로그래밍)
네트워크 스터디(Tcp 소켓 프로그래밍)네트워크 스터디(Tcp 소켓 프로그래밍)
네트워크 스터디(Tcp 소켓 프로그래밍)MoonLightMS
 
TCP/IP 발표자료 - 김연수
TCP/IP 발표자료 - 김연수TCP/IP 발표자료 - 김연수
TCP/IP 발표자료 - 김연수Yeon Soo Kim
 
Ryu with OpenFlow 1.3, Traffic Monitor
Ryu with OpenFlow 1.3, Traffic MonitorRyu with OpenFlow 1.3, Traffic Monitor
Ryu with OpenFlow 1.3, Traffic Monitorjieun kim
 
20150525 open flow1.3_ryu_sdn_link aggregation 1_김지은
20150525 open flow1.3_ryu_sdn_link aggregation 1_김지은20150525 open flow1.3_ryu_sdn_link aggregation 1_김지은
20150525 open flow1.3_ryu_sdn_link aggregation 1_김지은jieun kim
 
[네트워크] TCP, 믿을 수 있나요!?
[네트워크] TCP, 믿을 수 있나요!?[네트워크] TCP, 믿을 수 있나요!?
[네트워크] TCP, 믿을 수 있나요!?용민 박
 
grade server - block socket
grade server - block socketgrade server - block socket
grade server - block socketGyuhyeon Nam
 
패킷의 전달과정
패킷의 전달과정패킷의 전달과정
패킷의 전달과정성연 김
 
150416 OpenStack Networking with Neutron Jieun, Kim
150416 OpenStack Networking with Neutron Jieun, Kim150416 OpenStack Networking with Neutron Jieun, Kim
150416 OpenStack Networking with Neutron Jieun, Kimjieun kim
 
닷넷 Apache avro
닷넷 Apache avro닷넷 Apache avro
닷넷 Apache avro흥배 최
 
ACL - cisco 2811 router
ACL - cisco 2811 router ACL - cisco 2811 router
ACL - cisco 2811 router 준기 홍
 
Jnetpcap quickguide
Jnetpcap quickguideJnetpcap quickguide
Jnetpcap quickguideSukjin Yun
 
Wire shark 사용법 및 네트워크 개론 살짝 설명
Wire shark 사용법 및 네트워크 개론 살짝 설명Wire shark 사용법 및 네트워크 개론 살짝 설명
Wire shark 사용법 및 네트워크 개론 살짝 설명진우 이
 
Welcome to keystone the open stack identity service_v1.0.0-20141208-1212
Welcome to keystone the open stack identity service_v1.0.0-20141208-1212Welcome to keystone the open stack identity service_v1.0.0-20141208-1212
Welcome to keystone the open stack identity service_v1.0.0-20141208-1212ymtech
 
Openstack Instance Resize
Openstack Instance ResizeOpenstack Instance Resize
Openstack Instance Resizeymtech
 
도커없이컨테이너 만들기 8편 - pid namespace
도커없이컨테이너 만들기 8편 - pid namespace도커없이컨테이너 만들기 8편 - pid namespace
도커없이컨테이너 만들기 8편 - pid namespaceSam Kim
 
뇌자T 1.네트워크와 tcpip
뇌자T   1.네트워크와 tcpip뇌자T   1.네트워크와 tcpip
뇌자T 1.네트워크와 tcpipsj k
 
우분투에 시스템콜 추가하기
우분투에 시스템콜 추가하기우분투에 시스템콜 추가하기
우분투에 시스템콜 추가하기Hoyoung Jung
 

Mais procurados (20)

네트워크 스터디(Tcp 소켓 프로그래밍)
네트워크 스터디(Tcp 소켓 프로그래밍)네트워크 스터디(Tcp 소켓 프로그래밍)
네트워크 스터디(Tcp 소켓 프로그래밍)
 
TCP/IP 발표자료 - 김연수
TCP/IP 발표자료 - 김연수TCP/IP 발표자료 - 김연수
TCP/IP 발표자료 - 김연수
 
Ryu with OpenFlow 1.3, Traffic Monitor
Ryu with OpenFlow 1.3, Traffic MonitorRyu with OpenFlow 1.3, Traffic Monitor
Ryu with OpenFlow 1.3, Traffic Monitor
 
20150525 open flow1.3_ryu_sdn_link aggregation 1_김지은
20150525 open flow1.3_ryu_sdn_link aggregation 1_김지은20150525 open flow1.3_ryu_sdn_link aggregation 1_김지은
20150525 open flow1.3_ryu_sdn_link aggregation 1_김지은
 
[네트워크] TCP, 믿을 수 있나요!?
[네트워크] TCP, 믿을 수 있나요!?[네트워크] TCP, 믿을 수 있나요!?
[네트워크] TCP, 믿을 수 있나요!?
 
grade server - block socket
grade server - block socketgrade server - block socket
grade server - block socket
 
패킷의 전달과정
패킷의 전달과정패킷의 전달과정
패킷의 전달과정
 
150416 OpenStack Networking with Neutron Jieun, Kim
150416 OpenStack Networking with Neutron Jieun, Kim150416 OpenStack Networking with Neutron Jieun, Kim
150416 OpenStack Networking with Neutron Jieun, Kim
 
닷넷 Apache avro
닷넷 Apache avro닷넷 Apache avro
닷넷 Apache avro
 
ACL - cisco 2811 router
ACL - cisco 2811 router ACL - cisco 2811 router
ACL - cisco 2811 router
 
NLog 소개
NLog 소개NLog 소개
NLog 소개
 
Jnetpcap quickguide
Jnetpcap quickguideJnetpcap quickguide
Jnetpcap quickguide
 
TCP/IP
TCP/IPTCP/IP
TCP/IP
 
Wire shark 사용법 및 네트워크 개론 살짝 설명
Wire shark 사용법 및 네트워크 개론 살짝 설명Wire shark 사용법 및 네트워크 개론 살짝 설명
Wire shark 사용법 및 네트워크 개론 살짝 설명
 
Welcome to keystone the open stack identity service_v1.0.0-20141208-1212
Welcome to keystone the open stack identity service_v1.0.0-20141208-1212Welcome to keystone the open stack identity service_v1.0.0-20141208-1212
Welcome to keystone the open stack identity service_v1.0.0-20141208-1212
 
네트워크 기본
네트워크 기본네트워크 기본
네트워크 기본
 
Openstack Instance Resize
Openstack Instance ResizeOpenstack Instance Resize
Openstack Instance Resize
 
도커없이컨테이너 만들기 8편 - pid namespace
도커없이컨테이너 만들기 8편 - pid namespace도커없이컨테이너 만들기 8편 - pid namespace
도커없이컨테이너 만들기 8편 - pid namespace
 
뇌자T 1.네트워크와 tcpip
뇌자T   1.네트워크와 tcpip뇌자T   1.네트워크와 tcpip
뇌자T 1.네트워크와 tcpip
 
우분투에 시스템콜 추가하기
우분투에 시스템콜 추가하기우분투에 시스템콜 추가하기
우분투에 시스템콜 추가하기
 

Destaque

Denoising auto encoders(d a)
Denoising auto encoders(d a)Denoising auto encoders(d a)
Denoising auto encoders(d a)Tae Young Lee
 
Network programming in python..
Network programming in python..Network programming in python..
Network programming in python..Bharath Kumar
 
Perspective of query
Perspective of queryPerspective of query
Perspective of queryTae Young Lee
 
The art of data science
The art of data scienceThe art of data science
The art of data scienceTae Young Lee
 
Sns(social network service)
Sns(social network service)Sns(social network service)
Sns(social network service)Tae Young Lee
 
Machine learning in spam
Machine learning in spamMachine learning in spam
Machine learning in spamTae Young Lee
 
OpenStack으로 바로보는 상용 클라우드 플랫폼
OpenStack으로 바로보는 상용 클라우드 플랫폼OpenStack으로 바로보는 상용 클라우드 플랫폼
OpenStack으로 바로보는 상용 클라우드 플랫폼Tae Young Lee
 
2017 tensor flow dev summit
2017 tensor flow dev summit2017 tensor flow dev summit
2017 tensor flow dev summitTae Young Lee
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTPMykhailo Kolesnyk
 
The .NET developer's introduction to IronPython
The .NET developer's introduction to IronPythonThe .NET developer's introduction to IronPython
The .NET developer's introduction to IronPythonDror Helper
 
언어의 변천사를 통해 바라본 Python
언어의 변천사를 통해 바라본 Python언어의 변천사를 통해 바라본 Python
언어의 변천사를 통해 바라본 PythonTae Young Lee
 
Spm12를 이용한 fmri analysis
Spm12를 이용한 fmri analysisSpm12를 이용한 fmri analysis
Spm12를 이용한 fmri analysisTae Young Lee
 
SyPy IronPython
SyPy IronPythonSyPy IronPython
SyPy IronPythonNick Hodge
 
QnA Blog Using Django - 회원가임/로그인폼, Post, 글보기
QnA Blog Using Django - 회원가임/로그인폼, Post, 글보기QnA Blog Using Django - 회원가임/로그인폼, Post, 글보기
QnA Blog Using Django - 회원가임/로그인폼, Post, 글보기Kwangyoun Jung
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to PythonKHNOG
 
Neural network의 변천사 이태영
Neural network의 변천사 이태영Neural network의 변천사 이태영
Neural network의 변천사 이태영Tae Young Lee
 
Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기
Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기
Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기Joongi Kim
 
Python 개발자를 위한 최상의 무료 개발 도구 Visual Studio와 Visual Studio Code
Python 개발자를 위한 최상의 무료 개발 도구 Visual Studio와 Visual Studio CodePython 개발자를 위한 최상의 무료 개발 도구 Visual Studio와 Visual Studio Code
Python 개발자를 위한 최상의 무료 개발 도구 Visual Studio와 Visual Studio Code명신 김
 
The other sensory systems
The other sensory systemsThe other sensory systems
The other sensory systemsTae Young Lee
 

Destaque (20)

Denoising auto encoders(d a)
Denoising auto encoders(d a)Denoising auto encoders(d a)
Denoising auto encoders(d a)
 
Network programming in python..
Network programming in python..Network programming in python..
Network programming in python..
 
Perspective of query
Perspective of queryPerspective of query
Perspective of query
 
The art of data science
The art of data scienceThe art of data science
The art of data science
 
Sns(social network service)
Sns(social network service)Sns(social network service)
Sns(social network service)
 
Machine learning in spam
Machine learning in spamMachine learning in spam
Machine learning in spam
 
OpenStack으로 바로보는 상용 클라우드 플랫폼
OpenStack으로 바로보는 상용 클라우드 플랫폼OpenStack으로 바로보는 상용 클라우드 플랫폼
OpenStack으로 바로보는 상용 클라우드 플랫폼
 
2017 tensor flow dev summit
2017 tensor flow dev summit2017 tensor flow dev summit
2017 tensor flow dev summit
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTP
 
The .NET developer's introduction to IronPython
The .NET developer's introduction to IronPythonThe .NET developer's introduction to IronPython
The .NET developer's introduction to IronPython
 
언어의 변천사를 통해 바라본 Python
언어의 변천사를 통해 바라본 Python언어의 변천사를 통해 바라본 Python
언어의 변천사를 통해 바라본 Python
 
Spm12를 이용한 fmri analysis
Spm12를 이용한 fmri analysisSpm12를 이용한 fmri analysis
Spm12를 이용한 fmri analysis
 
Jython
JythonJython
Jython
 
SyPy IronPython
SyPy IronPythonSyPy IronPython
SyPy IronPython
 
QnA Blog Using Django - 회원가임/로그인폼, Post, 글보기
QnA Blog Using Django - 회원가임/로그인폼, Post, 글보기QnA Blog Using Django - 회원가임/로그인폼, Post, 글보기
QnA Blog Using Django - 회원가임/로그인폼, Post, 글보기
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Neural network의 변천사 이태영
Neural network의 변천사 이태영Neural network의 변천사 이태영
Neural network의 변천사 이태영
 
Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기
Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기
Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기
 
Python 개발자를 위한 최상의 무료 개발 도구 Visual Studio와 Visual Studio Code
Python 개발자를 위한 최상의 무료 개발 도구 Visual Studio와 Visual Studio CodePython 개발자를 위한 최상의 무료 개발 도구 Visual Studio와 Visual Studio Code
Python 개발자를 위한 최상의 무료 개발 도구 Visual Studio와 Visual Studio Code
 
The other sensory systems
The other sensory systemsThe other sensory systems
The other sensory systems
 

Semelhante a Python Network Programming

Do IoT Yourself! - 사물 간의 연결을 위한 Open API
Do IoT Yourself! - 사물 간의 연결을 위한 Open APIDo IoT Yourself! - 사물 간의 연결을 위한 Open API
Do IoT Yourself! - 사물 간의 연결을 위한 Open APIHyunghun Cho
 
Actual PoC guide for Virtual Desktop Infrastructure (Korean)
Actual PoC guide for Virtual Desktop Infrastructure (Korean)Actual PoC guide for Virtual Desktop Infrastructure (Korean)
Actual PoC guide for Virtual Desktop Infrastructure (Korean)Changhyun Lim
 
Web App Security 2015.10
Web App Security 2015.10Web App Security 2015.10
Web App Security 2015.10Chanjin Park
 
[KGC 2011]Boost 라이브러리와 C++11
[KGC 2011]Boost 라이브러리와 C++11[KGC 2011]Boost 라이브러리와 C++11
[KGC 2011]Boost 라이브러리와 C++11흥배 최
 
[D2 CAMPUS]웹 개발자의 스펙 : HTTP
[D2 CAMPUS]웹 개발자의 스펙 : HTTP[D2 CAMPUS]웹 개발자의 스펙 : HTTP
[D2 CAMPUS]웹 개발자의 스펙 : HTTPNAVER D2
 
Do IoT Yourself 3rd : Open API - revision 3
Do IoT Yourself 3rd : Open API - revision 3Do IoT Yourself 3rd : Open API - revision 3
Do IoT Yourself 3rd : Open API - revision 3Hyunghun Cho
 
[Windows via c/c++] 4장 프로세스
[Windows via c/c++] 4장 프로세스[Windows via c/c++] 4장 프로세스
[Windows via c/c++] 4장 프로세스종빈 오
 
한국청소년정보과학회 1회 세미나 - RestFul API Basic
한국청소년정보과학회 1회 세미나 - RestFul API Basic한국청소년정보과학회 1회 세미나 - RestFul API Basic
한국청소년정보과학회 1회 세미나 - RestFul API Basic한국청소년정보과학회
 
PHP Log Tracking with ELK & Filebeat part#2
PHP Log Tracking with ELK & Filebeat part#2PHP Log Tracking with ELK & Filebeat part#2
PHP Log Tracking with ELK & Filebeat part#2Juwon Kim
 
C#을 사용한 빠른 툴 개발
C#을 사용한 빠른 툴 개발C#을 사용한 빠른 툴 개발
C#을 사용한 빠른 툴 개발흥배 최
 
Azure로 MMO게임 서비스하기
Azure로 MMO게임 서비스하기Azure로 MMO게임 서비스하기
Azure로 MMO게임 서비스하기YEONG-CHEON YOU
 
Google Protocol buffer
Google Protocol bufferGoogle Protocol buffer
Google Protocol bufferknight1128
 
DynamoDB를 이용한 PHP와 Django간 세션 공유 - 강대성 (피플펀드컴퍼니)
DynamoDB를 이용한 PHP와 Django간 세션 공유 - 강대성 (피플펀드컴퍼니)DynamoDB를 이용한 PHP와 Django간 세션 공유 - 강대성 (피플펀드컴퍼니)
DynamoDB를 이용한 PHP와 Django간 세션 공유 - 강대성 (피플펀드컴퍼니)AWSKRUG - AWS한국사용자모임
 
[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기
[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기
[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기Jaeseung Ha
 
20201121 코드 삼분지계
20201121 코드 삼분지계20201121 코드 삼분지계
20201121 코드 삼분지계Chiwon Song
 
IBM developer day 2018 - hyperledger composer
IBM developer day 2018 - hyperledger composerIBM developer day 2018 - hyperledger composer
IBM developer day 2018 - hyperledger composer동건 이
 
802.1X 적용 사례(차세대 정보보안을 위한 동적 네트워크 환경 구성과 접근통제)
802.1X 적용 사례(차세대 정보보안을 위한 동적 네트워크 환경 구성과 접근통제)802.1X 적용 사례(차세대 정보보안을 위한 동적 네트워크 환경 구성과 접근통제)
802.1X 적용 사례(차세대 정보보안을 위한 동적 네트워크 환경 구성과 접근통제)MinChoul Lee
 
Hyperledger fabric practice(pdf)
Hyperledger fabric practice(pdf)Hyperledger fabric practice(pdf)
Hyperledger fabric practice(pdf)wonyong hwang
 

Semelhante a Python Network Programming (20)

Do IoT Yourself! - 사물 간의 연결을 위한 Open API
Do IoT Yourself! - 사물 간의 연결을 위한 Open APIDo IoT Yourself! - 사물 간의 연결을 위한 Open API
Do IoT Yourself! - 사물 간의 연결을 위한 Open API
 
Actual PoC guide for Virtual Desktop Infrastructure (Korean)
Actual PoC guide for Virtual Desktop Infrastructure (Korean)Actual PoC guide for Virtual Desktop Infrastructure (Korean)
Actual PoC guide for Virtual Desktop Infrastructure (Korean)
 
Web App Security 2015.10
Web App Security 2015.10Web App Security 2015.10
Web App Security 2015.10
 
[KGC 2011]Boost 라이브러리와 C++11
[KGC 2011]Boost 라이브러리와 C++11[KGC 2011]Boost 라이브러리와 C++11
[KGC 2011]Boost 라이브러리와 C++11
 
[D2 CAMPUS]웹 개발자의 스펙 : HTTP
[D2 CAMPUS]웹 개발자의 스펙 : HTTP[D2 CAMPUS]웹 개발자의 스펙 : HTTP
[D2 CAMPUS]웹 개발자의 스펙 : HTTP
 
Do IoT Yourself 3rd : Open API - revision 3
Do IoT Yourself 3rd : Open API - revision 3Do IoT Yourself 3rd : Open API - revision 3
Do IoT Yourself 3rd : Open API - revision 3
 
[Windows via c/c++] 4장 프로세스
[Windows via c/c++] 4장 프로세스[Windows via c/c++] 4장 프로세스
[Windows via c/c++] 4장 프로세스
 
한국청소년정보과학회 1회 세미나 - RestFul API Basic
한국청소년정보과학회 1회 세미나 - RestFul API Basic한국청소년정보과학회 1회 세미나 - RestFul API Basic
한국청소년정보과학회 1회 세미나 - RestFul API Basic
 
PHP Log Tracking with ELK & Filebeat part#2
PHP Log Tracking with ELK & Filebeat part#2PHP Log Tracking with ELK & Filebeat part#2
PHP Log Tracking with ELK & Filebeat part#2
 
Kafka slideshare
Kafka   slideshareKafka   slideshare
Kafka slideshare
 
C#을 사용한 빠른 툴 개발
C#을 사용한 빠른 툴 개발C#을 사용한 빠른 툴 개발
C#을 사용한 빠른 툴 개발
 
Azure로 MMO게임 서비스하기
Azure로 MMO게임 서비스하기Azure로 MMO게임 서비스하기
Azure로 MMO게임 서비스하기
 
Google Protocol buffer
Google Protocol bufferGoogle Protocol buffer
Google Protocol buffer
 
DynamoDB를 이용한 PHP와 Django간 세션 공유 - 강대성 (피플펀드컴퍼니)
DynamoDB를 이용한 PHP와 Django간 세션 공유 - 강대성 (피플펀드컴퍼니)DynamoDB를 이용한 PHP와 Django간 세션 공유 - 강대성 (피플펀드컴퍼니)
DynamoDB를 이용한 PHP와 Django간 세션 공유 - 강대성 (피플펀드컴퍼니)
 
Lam pstack
Lam pstackLam pstack
Lam pstack
 
[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기
[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기
[NDC2015] 언제 어디서나 프로파일링 가능한 코드네임 JYP 작성기 - 라이브 게임 배포 후에도 프로파일링 하기
 
20201121 코드 삼분지계
20201121 코드 삼분지계20201121 코드 삼분지계
20201121 코드 삼분지계
 
IBM developer day 2018 - hyperledger composer
IBM developer day 2018 - hyperledger composerIBM developer day 2018 - hyperledger composer
IBM developer day 2018 - hyperledger composer
 
802.1X 적용 사례(차세대 정보보안을 위한 동적 네트워크 환경 구성과 접근통제)
802.1X 적용 사례(차세대 정보보안을 위한 동적 네트워크 환경 구성과 접근통제)802.1X 적용 사례(차세대 정보보안을 위한 동적 네트워크 환경 구성과 접근통제)
802.1X 적용 사례(차세대 정보보안을 위한 동적 네트워크 환경 구성과 접근통제)
 
Hyperledger fabric practice(pdf)
Hyperledger fabric practice(pdf)Hyperledger fabric practice(pdf)
Hyperledger fabric practice(pdf)
 

Mais de Tae Young Lee

Review of the Paper on Capabilities of Gemini Models in Medicine
Review of the Paper on Capabilities of Gemini Models in MedicineReview of the Paper on Capabilities of Gemini Models in Medicine
Review of the Paper on Capabilities of Gemini Models in MedicineTae Young Lee
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)Tae Young Lee
 
LLMs Service that provides what users want to know
LLMs Service that provides what users want to knowLLMs Service that provides what users want to know
LLMs Service that provides what users want to knowTae Young Lee
 
Exploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMsExploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMsTae Young Lee
 
LLM 모델 기반 서비스 실전 가이드
LLM 모델 기반 서비스 실전 가이드LLM 모델 기반 서비스 실전 가이드
LLM 모델 기반 서비스 실전 가이드Tae Young Lee
 
Recommendation System History
Recommendation System HistoryRecommendation System History
Recommendation System HistoryTae Young Lee
 
검색엔진에 적용된 ChatGPT
검색엔진에 적용된 ChatGPT검색엔진에 적용된 ChatGPT
검색엔진에 적용된 ChatGPTTae Young Lee
 
검색엔진에 적용된 딥러닝 모델 방법론
검색엔진에 적용된 딥러닝 모델 방법론검색엔진에 적용된 딥러닝 모델 방법론
검색엔진에 적용된 딥러닝 모델 방법론Tae Young Lee
 
The Deep Learning Compiler
The Deep Learning CompilerThe Deep Learning Compiler
The Deep Learning CompilerTae Young Lee
 
History of Vision AI
History of Vision AIHistory of Vision AI
History of Vision AITae Young Lee
 
Enhanced ai platform
Enhanced ai platformEnhanced ai platform
Enhanced ai platformTae Young Lee
 
Real estate trust solution
Real estate trust solutionReal estate trust solution
Real estate trust solutionTae Young Lee
 
Transfer learning usage
Transfer learning usageTransfer learning usage
Transfer learning usageTae Young Lee
 
Create a solution including deep learning models
Create a solution including deep learning modelsCreate a solution including deep learning models
Create a solution including deep learning modelsTae Young Lee
 
Infra as a model service
Infra as a model serviceInfra as a model service
Infra as a model serviceTae Young Lee
 

Mais de Tae Young Lee (20)

Review of the Paper on Capabilities of Gemini Models in Medicine
Review of the Paper on Capabilities of Gemini Models in MedicineReview of the Paper on Capabilities of Gemini Models in Medicine
Review of the Paper on Capabilities of Gemini Models in Medicine
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)
 
LLMs Service that provides what users want to know
LLMs Service that provides what users want to knowLLMs Service that provides what users want to know
LLMs Service that provides what users want to know
 
Exploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMsExploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMs
 
LLM 모델 기반 서비스 실전 가이드
LLM 모델 기반 서비스 실전 가이드LLM 모델 기반 서비스 실전 가이드
LLM 모델 기반 서비스 실전 가이드
 
Recommendation System History
Recommendation System HistoryRecommendation System History
Recommendation System History
 
검색엔진에 적용된 ChatGPT
검색엔진에 적용된 ChatGPT검색엔진에 적용된 ChatGPT
검색엔진에 적용된 ChatGPT
 
검색엔진에 적용된 딥러닝 모델 방법론
검색엔진에 적용된 딥러닝 모델 방법론검색엔진에 적용된 딥러닝 모델 방법론
검색엔진에 적용된 딥러닝 모델 방법론
 
PaLM Paper Review
PaLM Paper ReviewPaLM Paper Review
PaLM Paper Review
 
The Deep Learning Compiler
The Deep Learning CompilerThe Deep Learning Compiler
The Deep Learning Compiler
 
History of Vision AI
History of Vision AIHistory of Vision AI
History of Vision AI
 
Aws architecture
Aws architectureAws architecture
Aws architecture
 
Enhanced ai platform
Enhanced ai platformEnhanced ai platform
Enhanced ai platform
 
Nvidia architecture
Nvidia architectureNvidia architecture
Nvidia architecture
 
Ai based on gpu
Ai based on gpuAi based on gpu
Ai based on gpu
 
Real estate trust solution
Real estate trust solutionReal estate trust solution
Real estate trust solution
 
Transfer learning usage
Transfer learning usageTransfer learning usage
Transfer learning usage
 
Create a solution including deep learning models
Create a solution including deep learning modelsCreate a solution including deep learning models
Create a solution including deep learning models
 
Infra as a model service
Infra as a model serviceInfra as a model service
Infra as a model service
 
Bayesian learning
Bayesian learningBayesian learning
Bayesian learning
 

Python Network Programming

  • 2. Contents • Printing your machine's name and IPv4 address • Retrieving a remote machine's IP address • Converting an IPv4 address to dierent formats • Finding a service name, given the port and protocol • Converting integers to and from host to network byte order
  • 3. Printing your machine's name and IPv4 address C:UsersUser>python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> host_name = socket.gethostname() >>> print "Host name : %s" %host_name Host name : 이태영-PC >>> print "IP address : %s" %socket.gethostbyname(host_name) IP address : 169.254.236.217
  • 4.
  • 5. Quiz 1 • 자신의 PC 이름과 IPv4 address를 출력할 함수를 만들어 구현하기
  • 7. Retrieving a remote machine's IP address • https://docs.python.org/3/library/socket.h tml • built-in library function – gethostbyname()
  • 9. Quiz 2 • Remote machine의 IP주소를 가져올 수 있 는 함수 구현하기
  • 10. HINT
  • 12. Converting an IPv4 address to dierent formats • 파이썬 소켓 라이브러리는 다양한 IP 주소 형식을 다루는 유틸리티가 있습니다. • 우리가 두 가지 사용 : – inet_aton () – inet_ntoa () • convert_ip4_address () 함수, inet_aton을 만들어 보자 • inet_ntoa ()는 IP 주소 변환을 위해 사용된다. • 우리는 두 개의 샘플 IP를 사용합니다 – 주소, 127.0.0.1과 192.168.0.1.
  • 14. Finding a service name, given the port and protocol 우리가 find_service_name () 함수를 정의 • 여기서 getservbyport를 () 소켓 클래스 함수 는, (25)는, 예를 들면, 몇 개의 포트 (80)를 호 출 • 포트에 대한 서비스를 찾기 위한 함수를 구현 한다.
  • 16. Converting integers to and from host to network byte order • 파이썬의 소켓 라이브러리는 바이트 순서와 그 반대를 호스팅하는 네트워크 바이트 순서 로 변환하는 유틸리티가 있습니다. • ntohl () / htonl() 함수를 사용 • ntohl () / htonl () 소켓 클래스 함수는 IP 어 드레스 포맷을 변환하기 위해 사용 • convert_integer () 함수를 정의하자.