Answers for "send from python socket"

0

post request socket python

from socket import socket,error
headers = """GET http://www.google.com HTTP/1.1
                Host: www.google.comrnrn"""
try:
  s = socket()
  s.connect((host,int(port)))
  s.settimeout(4)
  s.send(headers.encode())
  s.recv(800)
  s.close()
except error:
  s.close()
Posted by: Guest on March-11-2021
0

socket python functions

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    pass  # Use the socket object without calling s.close().
Posted by: Guest on June-09-2021

Python Answers by Framework

Browse Popular Code Answers by Language