Hi everyone,
I have been starting out with python over the past 8 months. I know I'm just at the start of my journey, and this is the first programming language that I have been working with.
I am currently playing around with socket.
My question is simple, why do I need double parenthesis sock.connect((ipaddress, port)), to get my program to work?
I have been starting out with python over the past 8 months. I know I'm just at the start of my journey, and this is the first programming language that I have been working with.
I am currently playing around with socket.
My question is simple, why do I need double parenthesis sock.connect((ipaddress, port)), to get my program to work?
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import socket #from IPy import IP ipaddress = input ( "Enter target to scan: " ) port = 80 #Esablish a connection to a port using socket try : sock = socket.socket() sock.connect((ipaddress, port)) print ( "[+] Port 80 is open: " ) except : print ( "[-] Port 80 is closed: " ) |