nodetunes
nodetunes copied to clipboard
UDP Port Reuse across different instances
Currently using portastic to assign ports for UDP/RTP stream. Problem is that portastic doesn't detect UDP port usage (not sure how to do this in general?), so portastic will likely give us the same ports for two different instances of the nodetunes server.
Seems to become a problem when two servers are listening on the same udp port for incoming audio from possibly two separate sources, causing stream/uninitialization errors?
Might also want to check on when we begin listening on UDP - make sure it doesn't start listening prematurely.
Somewhat mitigated by randomly selecting ports from 5000 to 9999 as of v0.0.10.
See https://github.com/stephen/nodetunes/blob/master/lib/rtspmethods.js#L101
Can be solved by using
socket.bind(0);
which causes node to pick a random, unused port. Port can be retrieved with socket.address().port
.