프로그래밍/Python
[Python] socket 모듈
jaewoo93
2022. 11. 23. 00:17
import socket
hostName = socket.gethostname()
in_addr = socket.gethostbyname(hostName)
print(hostName)
print(in_addr)
gethostname() : 로컬호스트의 이름을 리턴
gethostbyname(socket.gethostname()) : 로컬호스트의 이름을 사용하여 ip 리턴
--------------------------------------------------------------------------------------------------------------------------
in_addr = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
소켓 연결