Reputation:
I can't understand one thing- does NodeJS allow to listen to custom hostname? Not localhost. Because when I listen to my website url (example.com), I'm getting the following error:
Error: listen EADDRNOTAVAIL example.com ip-address:1000 at Object.exports._errnoException (util.js:1022:11) at exports._exceptionWithHostPort (util.js:1045:20) at Server._listen2 (net.js:1246:19) at listen (net.js:1295:10) at net.js:1405:9 at _combinedTickCallback (internal/process/next_tick.js:77:11) at process._tickCallback (internal/process/next_tick.js:98:9) at Module.runMain (module.js:606:11) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9)
Why does it happend? And can I listen for POST messages from external site URL?
Upvotes: 0
Views: 1128
Reputation: 11786
Why does it happend?
This happens because the hostname
and port
you requested isn't available to you.
can I listen for POST messages from external site URL?
No, You can't. server.listen() accepts hostname
and port
Begin accepting connections on the specified port and hostname. If the hostname is omitted, the server will accept connections on any IPv6 address (::) when IPv6 is available, or any IPv4 address (0.0.0.0) otherwise. Omit the port argument, or use a port value of 0, to have the operating system assign a random port, which can be retrieved by using server.address().port after the 'listening' event has been emitted.
And further digging into list of Node.js Common System Errors docs and exhaustive list, It is clear that, Address not available
was the case.
EADDRNOTAVAIL Address not available (POSIX.1).
Upvotes: 0