anudeepr28 / phpdesktop

Automatically exported from code.google.com/p/phpdesktop
0 stars 0 forks source link

Check if port 54007 is free before running web-server #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The default port for running php web-server is 54007, but
this port might already be occupied by another application
or by our application when running multiple instances. 
Therefore we should check if this port is free and if not
then generate a random port in the range 49152–65535, try
drawing for at least 100 tries until you find a free port.

How to check if port is free? Need to google it.

Original issue reported on code.google.com by czarek.t...@gmail.com on 13 Jan 2013 at 5:13

GoogleCodeExporter commented 9 years ago
I've just run multiple instances of phpdesktop and seems that
there is no problem running multiple php web-servers on the
same port. Why is that possible?

Original comment by czarek.t...@gmail.com on 13 Jan 2013 at 5:22

GoogleCodeExporter commented 9 years ago
Mongoose seems to be fine when running multiple instances of an
application with each instance starting web-server on the same port.

Original comment by czarek.t...@gmail.com on 19 Jan 2013 at 6:04

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
See this topic on mongoose-users forum:
"How to check if port is free?"
https://groups.google.com/d/topic/mongoose-users/vBJ0bZHmOv8/discussion

Original comment by czarek.t...@gmail.com on 2 Feb 2013 at 3:28

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Check also if "remote-debugging-port" is free. If not, generate some random 
port for that too.

Original comment by czarek.t...@gmail.com on 24 Jan 2014 at 5:10

GoogleCodeExporter commented 9 years ago
When launching a second application that has the same listening port set, then 
the content from the first application that started a webserver on that port, 
will be served. So this is some serious issue. If there are two different 
applications and we display application 1 content in application 2, then this 
is really bad.

Original comment by czarek.t...@gmail.com on 25 Jan 2014 at 10:08

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Each instance of the same application should run on a different port, otherwise 
the --cgi-environment argument used to launch a second application instance, 
will not take effect as it is the first webserver that will be serving content.

Original comment by czarek.t...@gmail.com on 25 Jan 2014 at 10:19

GoogleCodeExporter commented 9 years ago
After a minor modification to mongoose sources, it now accepts port "0", 
thereby OS assigns a random free port. Now I need a way to get know the port 
that was assigned. Created a topic about that on mongoose-users group:

https://groups.google.com/d/topic/mongoose-users/spyD60wLcGE/discussion

Original comment by czarek.t...@gmail.com on 25 Jan 2014 at 1:04

GoogleCodeExporter commented 9 years ago
Fixed in revision 8091beb8d108. When port is set to 0 in settings.json, OS will 
assign a random free port.

Original comment by czarek.t...@gmail.com on 25 Jan 2014 at 3:44

GoogleCodeExporter commented 9 years ago
Chrome 31.4 and MSIE 1.12 released.

Original comment by czarek.t...@gmail.com on 26 Jan 2014 at 1:25