litmus icon indicating copy to clipboard operation
litmus copied to clipboard

How to set host and port of a server?

Open KhDenys opened this issue 4 years ago • 1 comments

I got an error if follow case:

async def main():
    global server
    runner = pyre.LSGIToASGIAdapter(app)
    server = pyre.Server(runner, listen_on='localhost:8080')
    server.ignite()
    await server.run_forever()

An example of an error:

pyre       |  INFO  pyre_server::server > binding to :
pyre       | Traceback (most recent call last):
pyre       |   File "test.py", line 34, in <module>
pyre       |     asyncio.run(main())
pyre       |   File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
pyre       |     return loop.run_until_complete(main)
pyre       |   File "uvloop/loop.pyx", line 1494, in uvloop.loop.Loop.run_until_complete
pyre       |   File "test.py", line 28, in main
pyre       |     server = pyre.Server(runner, listen_on='0.0.0.0:8080')
pyre       |   File "/code/pyre/pyre_http/shared.py", line 62, in __init__
pyre       |     self._server = create_server(
pyre       | OSError: invalid port value

KhDenys avatar Jul 09 '21 16:07 KhDenys

pyre takes a list of addresses to bind to, e.g. listen_on=["127.0.0.1:7070", "127.0.0.1:9090"]

ChillFish8 avatar Jul 14 '21 10:07 ChillFish8