{"id":1281,"date":"2026-01-09T13:39:22","date_gmt":"2026-01-09T13:39:22","guid":{"rendered":"https:\/\/monkey.ploogie.co.uk\/?page_id=1281"},"modified":"2026-01-12T04:32:20","modified_gmt":"2026-01-12T04:32:20","slug":"mwnci-port2pid-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-port2pid-function\/","title":{"rendered":"Mwnci port2pid() Function"},"content":{"rendered":"<h2>Syntax<\/h2>\n<p>port2pid<strong>(<em>integer<\/em>)<\/strong><\/p>\n<h2>Description<\/h2>\n<p>The <i>port2pid()<\/i> function returns a hash containing process id&#8217;s and process name for a given port number.<br \/>\nIf no process can be found, then an empty hash is returned.<\/p>\n<p><em>Note: <\/em> If called as a standard user, port2pid() will only show process id&#8217;s of the calling user. <\/p>\n<h2>Example<\/h2>\n<pre>include(\"net\")\r\nprintln(port2pid(80))\r\nprintln(port2pid(22))\r\nprintln(port2pid(8000))\r\n\r\n{\"pids\": [1086, 164844, 164845], \"proc\": \"apache2\"}\r\n{\"pids\": [797], \"proc\": \"sshd\"}\r\n{}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Syntax port2pid(integer) Description The port2pid() function returns a hash containing process id&#8217;s and process name for a given port number. If no process can be found, then an empty hash is returned. Note: If called as a standard user, port2pid() will only show process id&#8217;s of the calling user. Example include(&#8220;net&#8221;) println(port2pid(80)) println(port2pid(22)) println(port2pid(8000)) {&#8220;pids&#8221;: &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-port2pid-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci port2pid() Function&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1281","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/1281","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=1281"}],"version-history":[{"count":3,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/1281\/revisions"}],"predecessor-version":[{"id":1294,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/1281\/revisions\/1294"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=1281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}