Accesing internal web server running Node.js

GijsjanB picture GijsjanB · Nov 2, 2011 · Viewed 13.3k times · Source

I have two laptops on a WiFi. One has XP (192.168.2.100) and one has Peppermint Linux (192.168.2.106). Both connect to the internet through a WiFi router (192.168.2.1). Peppermint has a Node.js webserver running which I can see when I run localhost:8000. I am able to ping and ssh from the XP-laptop to the Peppermint-laptop. Now I must be able to see the webserver in XP when I use the IP-address with the right port (ie: 192.168.2.106:8000), but nothing is happening. Could it be the port (8000) is closed on the XP-laptop? I also tried port 9000 which says "listening", but to no avail.

Any help is appreciated!

edit: To test if the setup is correct I installed Apache and voila, it works! But the question remains, what do I need to do to be able to reach the Node.js web server from the XP-laptop?

Answer

geoffreak picture geoffreak · Nov 2, 2011

Odds are your issue is that you specified a hostname when listening on the server. According to the documentation:

server.listen(port, [hostname], [callback])

Begin accepting connections on the specified port and hostname. If the hostname is omitted, the server will accept connections directed to any IPv4 address (INADDR_ANY).