Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Ticket #537 (enhancement)

Opened 2 years ago

Last modified 2 years ago

Support for listening on multiple ports

Status: closed (fixed)

Reported by: cduffy@spamcop.net Assigned to: fumanchu
Priority: normal Milestone: 3.0
Component: CherryPy code Keywords:
Cc:

CherryPy does not provide a simple mechanism for litening on multiple ports, as cherrypy.config's state is not thread-local. The mailing list thread leading to the filing of this bug is below.

Charles Duffy wrote:

Quick question: Is there an easy way to make a CherryPy-
based application bind to multiple ports? It's obviously
straightforward if going through Apache, but I'm thinking
about this in the context of a much smaller,
self-contained package.

James Mills wrote:

Could you not run two threads ? (Configured on different ports)

Charles Duffy:

Err... how do I do that? Is cherrypy.config's state thread-local?

Robert Brewer:

The "server.socket_port" isn't--it's read once when starting the
server. You'd have to start your own http server by hand
(_cpwsgiserver has no dependency on CherryPy, so it should mostly be a
matter of duplicating the logic of _cpwsgi.WSGIServer.__init__).

I'd appreciate a ticket on this for CherryPy 3 at least--go ahead and
assign it to me (fumanchu).

Change History

08/05/06 17:16:11: Modified by fumanchu

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [1217].

I didn't think it was worth the effort to make new config entries for this use-case, so the normal cherrypy.server.start hasn't changed. But cherrypy.server may now manage multiple HTTP servers through programmatic means; just set cherrypy.server.httpservers[httpserver instance] = (host, port) if you need more than one.

08/05/06 18:07:31: Modified by fumanchu

Bah. Keeping the old start() method really screws up code (like test_states) that tried to start after a stop. So in [1219] I just bit the bullet and renamed server.start to server.quickstart, and server.start_all to server.start.

Hosted by WebFaction

Log in as guest/cpguest to create tickets