# wait\_for module related

**URL:** <https://forum.ansible.com/t/wait-for-module-related/18316>\
**Category:** Ansible Project\
**Created:** [May 27, 2015, 7:19am UTC](https://forum.ansible.com/t/wait-for-module-related/18316 "2015-05-27T07:19:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max1](https://avatars.discourse-cdn.com/v4/letter/m/e99b99/32.png) [@Max1](https://forum.ansible.com/u/Max1)\
**Post date:** [May 27, 2015, 7:19am UTC](https://forum.ansible.com/t/wait-for-module-related/18316/1 "2015-05-27T07:19:05Z")

</div>

I was wondering how does wait\_for figures out if a port is listening on remote machine. Does it use port scanners like nmap or netcat or simply makes a telnet connection on that port?

---

<div class="post-metadata">

**Author:** ![alxgu1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@alxgu1](https://forum.ansible.com/u/alxgu1)\
**Post date:** [May 27, 2015, 9:39am UTC](https://forum.ansible.com/t/wait-for-module-related/18316/2 "2015-05-27T09:39:43Z")

</div>

It will try to open a socket.

…  
s = socket.socket(socket.AF\_INET, socket.SOCK\_STREAM)  
s.settimeout(connect\_timeout)  
try:  
s.connect( (host, port) )  
…
