# hopen 5001   =&gt;   'hop. OS reports:

**URL:** <https://forum.kx.com/t/hopen-5001-gt-hop-os-reports/13024>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [October 4, 2023, 3:28pm UTC](https://forum.kx.com/t/hopen-5001-gt-hop-os-reports/13024 "2023-10-04T15:28:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rosebroger1](https://avatars.discourse-cdn.com/v4/letter/r/a4c791/32.png) [@rosebroger1](https://forum.kx.com/u/rosebroger1)\
**Post date:** [October 4, 2023, 3:28pm UTC](https://forum.kx.com/t/hopen-5001-gt-hop-os-reports/13024/1 "2023-10-04T15:28:00Z")

</div>

Any clue about:

q)hopen 5001  
'hop. OS reports: No connection could be made because the target machine actively refused it.  
[0] hopen 5001  
^

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![rocuinneagain1](https://avatars.discourse-cdn.com/v4/letter/r/fbc32d/32.png) [@rocuinneagain1](https://forum.kx.com/u/rocuinneagain1)\
**Post date:** [October 4, 2023, 3:34pm UTC](https://forum.kx.com/t/hopen-5001-gt-hop-os-reports/13024/2 "2023-10-04T15:34:00Z")

</div>

https://code.kx.com/q/basics/errors/#:~:text=formed%20select%20query-,hop,-Request%20to%20hopen

_hop_

_Request to&nbsp;`hopen`&nbsp;a handle fails; includes message from OS_

&nbsp;

Your code is trying to open a handle to a process listening on port 5001 but one is not available.

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![rosebroger1](https://avatars.discourse-cdn.com/v4/letter/r/a4c791/32.png) [@rosebroger1](https://forum.kx.com/u/rosebroger1)\
**Post date:** [October 4, 2023, 3:51pm UTC](https://forum.kx.com/t/hopen-5001-gt-hop-os-reports/13024/3 "2023-10-04T15:51:00Z")

</div>

Thank you for reply.

Does that mean the port is not available to be listened to?

How can I find out which ports can be chosen in this case?

---

<div class="post-metadata">

**Author:** ![gyorokpeter-kx1](https://avatars.discourse-cdn.com/v4/letter/g/d26b3c/32.png) [@gyorokpeter-kx1](https://forum.kx.com/u/gyorokpeter-kx1)\
**Post date:** [October 4, 2023, 4:00pm UTC](https://forum.kx.com/t/hopen-5001-gt-hop-os-reports/13024/4 "2023-10-04T16:00:00Z")

</div>

It doesn’t necessarily mean that the port is not available, but that there is currently no process listening on it.

If you are expecting a server to be running on that port, you might want to check what’s up with it - it might be crashing or hanging in an error trap, not reaching the point where it opens the port.

If you are just experimenting, you first need to start a second q process with the command line parameters -p 5001&nbsp;which will make it listen on that port.

---

<div class="post-metadata">

**Author:** ![rosebroger1](https://avatars.discourse-cdn.com/v4/letter/r/a4c791/32.png) [@rosebroger1](https://forum.kx.com/u/rosebroger1)\
**Post date:** [October 4, 2023, 4:35pm UTC](https://forum.kx.com/t/hopen-5001-gt-hop-os-reports/13024/5 "2023-10-04T16:35:00Z")

</div>

Right, you’re right

Before using the hopen command, it is necessary to open the port listening with the \p command:

\p 5001&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /system[“p 5001”]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /q.exe -p 5001

hopen 5001

Now work

Thank you to all for answer
