To know how to connect fb using python socket programming using python3.
import socket module.
Create socket object.
Within socket object, we must pass the socket_family, socket_type.
Get host name(fb).
Connect socket with host_ip using s.connect().
#import socket and sys module
#define socket family
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print (“Socket successfully created”)
except socket.error as err:
print (“socket creation failed with error”,(err))
port = 80
host_ip = socket.gethostbyname(‘www.facebook.com’)
#exit the system if error occurs
print (“there was an error resolving the host”)
#connecting to the server
print (“The socket has been connected to