Short answer, change from 'localhost' to '0.0.0.0'. That's probably all you need.
Also check
- the port is open through your firewall, if you have one turned on.
- you can ping other devices on the wifi network. Some wifi access points restrict sending traffic from one node to another on the same wlan.
Longer answer:
When you use localhost as the hostname it's resolved (through system32/drivers/etc) to 127.0.0.1.
The network card is designed to restrict access from anywhere else to that ip address, so you will need to choose a different IP address to bind to.
You could choose the actual IP address for your machine, but that may change over time.
The special IP address, 0.0.0.0, means bind to all interfaces on the system.