Test if port open and forwarded using PHP

I’m not sure what you mean by being “forwarded properly”, but hopefully this example will do the trick: $host=”stackoverflow.com”; $ports = array(21, 25, 80, 81, 110, 443, 3306); foreach ($ports as $port) { $connection = @fsockopen($host, $port); if (is_resource($connection)) { echo ‘<h2>’ . $host . ‘:’ . $port . ‘ ‘ . ‘(‘ . getservbyport($port, … Read more

Access a localhost running in Windows from inside WSL2? [closed]

Short answer for most recent Windows versions mDNS has been a feature of WSL2 for a while now. Concatenating your WSL2 hostname (or the equivalent command/function in your programming/language environment) with “.local” should get you access. For example, from Bash, try: ping “$(hostname).local” For instance, if your hostname is “MyComputer”, then the mDNS should be … Read more

port forwarding in windows

I’ve solved it, it can be done executing: netsh interface portproxy add v4tov4 listenport=4422 listenaddress=192.168.1.111 connectport=80 connectaddress=192.168.0.33 To remove forwarding: netsh interface portproxy delete v4tov4 listenport=4422 listenaddress=192.168.1.111 Official docs