![]() |
|
[Python] Socket question - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Python] Socket question (/showthread.php?tid=6163990) |
Socket question - ghostdevelite - Jul 17, 2021 Hi there I just would like to ask what would be the meaning of this line : if(s.connect_ex((ip,int(ports)))==0): Thanks for your insights. RE: Socket question - 3phase - Jul 18, 2021 socket.connect_ex(address) -> return an error indicator instead of raising an exception for errors returned by the C-level connect() call (other problems, such as “host not found,” can still raise exceptions). The error indicator is 0 if the operation succeeded, which in your case that's literally means "if the connection succeeds". |