Home > other >  Python is how to achieve the same IP use different ports to provide services?
Python is how to achieve the same IP use different ports to provide services?

Time:02-04

Program, I made use of flask framework provides a web page, at the same time in the background and selectors + socket provides a command line interactive interface,

I hope to use only one IP address, binding different ports to provide different services, such as web use 8000, server 8001,

This how to implement, I met the current server starts, as long as the restart web services (flask), server side error, will prompt
OSError: [98] Errno Address already in use

CodePudding user response:

These two services is open in the same process, if no problem, different process
Is not clear flask did provide a similar solution, can provide different communication schemes, such as can the response page message, also can process the background of the socket communication,
  • Related