-
pxblat.start_server_mt(host: str, port: int, two_bit_file: str, server_option: ServerOption, stat: UsageStats, *, use_others: bool =
False, try_new_port: bool =True)[source] Starts a server on a new thread.
This function attempts to start a server on the given host and port, using the provided .2bit file, options, and usage stats. If the port is in use, it either waits for the server to be ready, tries a new port, or raises an error, depending on the options.
- Parameters:¶
- host : str¶
The hostname or IP address to start the server on.
- port : int¶
The initial port number to try to start the server on.
- two_bit_file : str¶
The .2bit file to use for the server.
- server_option : ServerOption¶
The options to use when starting the server.
- stat : UsageStats¶
The usage stats to use for the server.
- use_others : bool, optional¶
Whether to use the port even if it is already in use. Defaults to False.
- try_new_port : bool, optional¶
Whether to try a new port if the initial port is in use. Defaults to True.
- Raises:¶
ValueError – If the port is in use and neither ‘use_others’ nor ‘try_new_port’ is True.
Exception – If there is any other error in starting the server.