본문 바로가기
socket

Python - all ip check in pc

by space father python 2023. 1. 4.
반응형

Code

1
2
3
4
5
6
7
import socket
 
ip_tuple = socket.gethostbyname_ex(socket.getfqdn())
 
for ip in ip_tuple[2]:
    if '192.' in ip :
        print(ip)
cs

 

Result

#> python .\ip_check.py
192.168.4.44
192.168.2.9

 

 

'socket' 카테고리의 다른 글

Python - UDP (send, receive)  (0) 2023.01.05
python - multicast send with esp8266  (0) 2023.01.02
python - multicast receive with esp8266  (0) 2023.01.02