# hopen 5001   =\>   'hop. OS reports:

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

<div class="post-metadata">

**Author:** ![rosebroger](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@rosebroger](https://forum.kx.com/u/rosebroger)\
**Post date:** [October 4, 2023, 12:00am UTC](https://forum.kx.com/t/hopen-5001-hop-os-reports/13313/1 "2023-10-04T00:00:00Z")

</div>

[https://learninghub.kx.com/forums/topic/hopen-5001-hop-os-reports](https://learninghub.kx.com/forums/topic/hopen-5001-hop-os-reports)

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:** ![gyorokpeter-kx](https://avatars.discourse-cdn.com/v4/letter/g/d07c76/32.png) [@gyorokpeter-kx](https://forum.kx.com/u/gyorokpeter-kx)\
**Post date:** [October 4, 2023, 12:00am UTC](https://forum.kx.com/t/hopen-5001-hop-os-reports/13313/2 "2023-10-04T00: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 which will make it listen on that port.

---

<div class="post-metadata">

**Author:** ![rocuinneagain](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/rocuinneagain/32/287_2.png) [@rocuinneagain](https://forum.kx.com/u/rocuinneagain)\
**Post date:** [October 4, 2023, 12:00am UTC](https://forum.kx.com/t/hopen-5001-hop-os-reports/13313/3 "2023-10-04T00:00:00Z")

</div>

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

_hop_

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

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:** ![rosebroger](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@rosebroger](https://forum.kx.com/u/rosebroger)\
**Post date:** [October 4, 2023, 12:00am UTC](https://forum.kx.com/t/hopen-5001-hop-os-reports/13313/4 "2023-10-04T00:00: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:** ![rosebroger](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@rosebroger](https://forum.kx.com/u/rosebroger)\
**Post date:** [October 4, 2023, 12:00am UTC](https://forum.kx.com/t/hopen-5001-hop-os-reports/13313/5 "2023-10-04T00:00: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 /system[“p 5001”] /q.exe -p 5001

hopen 5001

Now work

Thank you to all for answer
