Skip to content

Commit

Permalink
Merge pull request hiroi-sora#138 from Gavin1937/main
Browse files Browse the repository at this point in the history
添加localhost作为套接字特殊地址
  • Loading branch information
hiroi-sora authored Jun 30, 2024
2 parents ab68748 + 41fab89 commit 927d11e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cpp/src/args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// 工作模式
DEFINE_string(image_path, "", "Set image_path to run a single task."); // 若填写了图片路径,则执行一次OCR。
DEFINE_int32(port, -1, "Set to 0 enable random port, set to 1~65535 enables specified port."); // 填写0随机端口号,填1^65535指定端口号。默认则启用匿名管道模式。
DEFINE_string(addr, "loopback", "Socket server addr, the value can be 'loopback', 'any', or other IPv4 address."); // 套接字服务器的地址模式,本地环回/任何可用。
DEFINE_string(addr, "loopback", "Socket server addr, the value can be 'loopback', 'localhost', 'any', or other IPv4 address."); // 套接字服务器的地址模式,本地环回/任何可用。

// common args 常用参数
DEFINE_bool(use_gpu, false, "Infering with GPU or CPU."); // true时启用GPU(需要推理库支持)
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ namespace PaddleOCR
int Task::addr_to_uint32(const std::string& addr, uint32_t& addr_out)
{
// 处理特殊情况
if (addr == "loopback")
if (addr == "loopback" || addr == "localhost")
{
addr_out = htonl(INADDR_LOOPBACK);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion docs/详细使用指南.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ TCP通信的性能比管道略低。单纯考虑传输延时,TCP本地环回

| 键名称 | 默认值 | 值说明 |
| ------ | -------- | ---------------------------------------------------------------------------------------- |
| addr | loopback | 指定开展服务的ip地址。可选值:`loopback`仅在本地环回(127.0.0.1)开展服务。`any`在本机任何可用ip地址开展服务。或者其他IPv4地址。 |
| addr | loopback | 指定开展服务的ip地址。可选值:`loopback`, `localhost`仅在本地环回(127.0.0.1)开展服务。`any`在本机任何可用ip地址开展服务。或者其他IPv4地址。 |
| port | -1 | 指定开展服务的端口。传入0时随机端口,传入1~65535则设为该端口。 |

**示例:**
Expand Down

0 comments on commit 927d11e

Please sign in to comment.