Port Already in Use

I have been having issues on and off since starting to use Plex Connect some times when it starts I receive an error that port 49152 is already in use(OR something to that effect)

 

When looking at the DNSServer.py file I found that port 49152 (Around line 146) is hard coded and has the following comments;

 

        # todo: where to get free port from?
        # todo: do we need bind?

 

I am no developer but I have found through a quick web search that instead of specifying a port number in this line;

DNS_forward.bind(('',49152))

 

if you just use;

DNS_forward.bind(('',0))

 

the next available port will be allocated.  Since I made this change to the file I have not had the issues at all. (Even with numerous restarts)  My PlexConnect is running on a Windows 2008 Server.

 

Anyway just in case someone else has the issue.

Nice information. I will have a look.

Thanks!

I have been having issues on and off since starting to use Plex Connect some times when it starts I receive an error that port 49152 is already in use(OR something to that effect)

When looking at the DNSServer.py file I found that port 49152 (Around line 146) is hard coded and has the following comments;

        # todo: where to get free port from?
        # todo: do we need bind?

I am no developer but I have found through a quick web search that instead of specifying a port number in this line;

DNS_forward.bind(('',49152))

if you just use;

DNS_forward.bind(('',0))

the next available port will be allocated.  Since I made this change to the file I have not had the issues at all. (Even with numerous restarts)  My PlexConnect is running on a Windows 2008 Server.

Anyway just in case someone else has the issue.

Nice find!  I have an issue with 49152 on my windows 7 box and it's random, I always have to change to something else like 49160 or something.  Cant wait to get home to try this out.  This is why I love open source projects :)

Put it in, work on my Mac as well. Commit done, you could grab the latest code.