Skip to content Skip to sidebar Skip to footer

OSError: [WinError 10022] An Invalid Argument Was Supplied

Im making a port scanner it through's this message here is my code but it checks one port 21 i have pasted output below import socket import os host = input('Enter the host name or

Solution 1:

You are passing the literal string 'host' as the host. You should be passing the variable host:

s.connect((host, port[p]))

You are also not actually closing the socket each time, since you left off the parentheses in s.close(). But if you did close the socket each time, you would have to create a new socket each time, instead of trying to reuse the same socket. You can't reuse a closed socket.


Post a Comment for "OSError: [WinError 10022] An Invalid Argument Was Supplied"