Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Socket question

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.
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".
Dude .


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by M0therB0ardSep 12, 2017 12:32 AM 1 123 Sep 12, 2017 12:32 AM
Last Post: vorticalbox
[Python] by michalmondayJun 15, 2017 06:58 PM 2 129 Jun 15, 2017 06:58 PM
Last Post: tulamba
[Python] by datguy.devSep 8, 2016 04:42 PM 0 61 Sep 8, 2016 04:42 PM
Last Post: datguy.dev