Language/Python1 TCP 클라이언트 import socket target_host = "www.google.com" target_port = 80 target_msg = "GET / HTTP/1.1\r\nHOST: koogle.com\r\n\r\n" client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect((target_host,target_port)) client.send(target_msg.encode('utf-8')) response = client.recv(4096).decode('utf-8') print(response) 8 : AF_INET(IPv4 또는 호스트명 사용), SOCK_STREAM(TCP 사용) 매개변수 이용해 소켓 객체 생성 9: 서버 접속.. 2022. 8. 17. 이전 1 다음