import socket\ndef portScannerWithSocket(ip_address, startPort, endPort):\n for port in range(startPort,endPort):\n  mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n  mySocket.settimeout(10)\n  scan = mySocket.connect_ex((ip_address,port))#connect_ex da 0 se si connette e codice di errore se non si connette\n  if scan == 0:\n   print("Porta {} APERTA", format(port))\n  else:\n   print("porta %d chiusa" %port)\n  mySocket.close()\n  \nportScannerWithSocket("2.231.198.9", 1, 85)