ENH: use a rare unfrequent port

Change-Id: I29cd679c9d1e435170cbd091cd85a0973cca1012
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2023-02-15 04:41:34 +08:00 committed by Lane.Wei
parent 0aa2916d4b
commit 7ecc8a9834
3 changed files with 4 additions and 3 deletions

View file

@ -130,7 +130,7 @@ void HttpServer::start()
m_http_server_thread = Slic3r::create_thread( m_http_server_thread = Slic3r::create_thread(
[this] { [this] {
boost::asio::io_service io_service; boost::asio::io_service io_service;
boost::asio::ip::tcp::endpoint endpoint{ boost::asio::ip::tcp::v4(), 9090}; boost::asio::ip::tcp::endpoint endpoint{ boost::asio::ip::tcp::v4(), LOCALHOST_PORT};
boost::asio::ip::tcp::acceptor acceptor { io_service, endpoint}; boost::asio::ip::tcp::acceptor acceptor { io_service, endpoint};
acceptor.listen(); acceptor.listen();
accept_and_run(acceptor, io_service); accept_and_run(acceptor, io_service);

View file

@ -16,7 +16,8 @@ using namespace boost;
using namespace boost::system; using namespace boost::system;
using namespace boost::asio; using namespace boost::asio;
#define LOCALHOST_URL "http://localhost:9090" #define LOCALHOST_PORT 13618
#define LOCALHOST_URL "http://localhost:"
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {

View file

@ -271,7 +271,7 @@ void ZUserLogin::OnScriptMessage(wxWebViewEvent &evt)
CallAfter([this, sequence_id] { CallAfter([this, sequence_id] {
json ack_j; json ack_j;
ack_j["command"] = "get_localhost_url"; ack_j["command"] = "get_localhost_url";
ack_j["response"]["base_url"] = LOCALHOST_URL; ack_j["response"]["base_url"] = std::string(LOCALHOST_URL) + std::to_string(LOCALHOST_PORT);
ack_j["response"]["result"] = "success"; ack_j["response"]["result"] = "success";
ack_j["sequence_id"] = sequence_id; ack_j["sequence_id"] = sequence_id;
wxString str_js = wxString::Format("window.postMessage(%s)", ack_j.dump()); wxString str_js = wxString::Format("window.postMessage(%s)", ack_j.dump());