Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit b3e0e504
authored
2025-12-19 09:09:11 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
启动备用端口时,跟端口相关的值需要重新设置
1 parent
3de75121
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
lib/config/constant.dart
lib/services/local_server_service.dart
lib/config/constant.dart
View file @
b3e0e50
...
...
@@ -12,13 +12,13 @@ class Constant {
static
int
localServerPort
=
35982
;
static
const
localServerPortOption
=
[
35982
,
35983
,
35984
];
static
final
String
localServerUrl
=
'http://
$localServerHost
:
$localServerPort
'
;
static
String
localServerUrl
=
'http://
$localServerHost
:
$localServerPort
'
;
static
final
String
localFileUrl
=
'http://127.0.0.1:
$localServerPort
'
;
static
String
localFileUrl
=
'http://127.0.0.1:
$localServerPort
'
;
static
const
String
localServerTemp
=
'/temp'
;
static
final
String
localServerTempFileUrl
=
'
$localFileUrl$localServerTemp
'
;
static
String
localServerTempFileUrl
=
'
$localFileUrl$localServerTemp
'
;
static
const
String
localServerTest
=
'/test'
;
static
final
String
localServerTestFileUrl
=
'
$localFileUrl$localServerTest
'
;
static
String
localServerTestFileUrl
=
'
$localFileUrl$localServerTest
'
;
/// obs 相关
/// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
lib/services/local_server_service.dart
View file @
b3e0e50
...
...
@@ -24,6 +24,12 @@ class LocalServerService {
try
{
server
=
await
HttpServer
.
bind
(
InternetAddress
.
loopbackIPv4
,
Constant
.
localServerPortOption
[
i
]);
Constant
.
localServerPort
=
server
.
port
;
// 端口改变之后,相应改变其它关联用到端口的值
Constant
.
localServerUrl
=
'http://
${Constant.localServerHost}
:
${Constant.localServerPort}
'
;
Constant
.
localFileUrl
=
'http://127.0.0.1:
${Constant.localServerPort}
'
;
Constant
.
localServerTempFileUrl
=
'
${Constant.localFileUrl}${Constant.localServerTemp}
'
;
Constant
.
localServerTestFileUrl
=
'
${Constant.localFileUrl}${Constant.localServerTest}
'
;
print
(
'本地服务器启动在端口:
${server.port}
'
);
break
;
}
on
SocketException
catch
(
e
)
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment