新增节点
+ + +点击或拖拽文件到此处上传
+文件将以编码形式保存,同一节点内数据不要超过1M
+ +加载中...
diff --git a/_inst.sh b/_inst.sh index 45c4867..4a4fe8f 100644 --- a/_inst.sh +++ b/_inst.sh @@ -30,4 +30,5 @@ inst_module "libhttp" inst_module "libcrypt" inst_module "gateway" inst_module "static" +inst_module "dnfs" inst_module "core" # core last diff --git a/core/_run.sh b/core/_run.sh index cdc554d..6f85ff4 100644 --- a/core/_run.sh +++ b/core/_run.sh @@ -1,4 +1,4 @@ #!/bin/bash cd "$(dirname "$0")" || exit -./nidus.out -i /etc/Nidus/init.txt --serve 5200 +./nidus.out -i init.txt --serve 5200 diff --git a/core/init.txt b/core/init.txt index d9dd105..92d9a9f 100644 --- a/core/init.txt +++ b/core/init.txt @@ -1,2 +1,3 @@ -bash /opt/micro_servers/gateway/_run.sh bash /opt/micro_servers/static/_run.sh +bash /opt/micro_servers/dnfs/_run.sh +bash /opt/micro_servers/gateway/_run.sh diff --git a/dnfs/.gitignore b/dnfs/.gitignore index aa67360..817ce2d 100644 --- a/dnfs/.gitignore +++ b/dnfs/.gitignore @@ -1,5 +1,10 @@ #prjs *.db +*.bin +*.build +*.dist +*.onefile-build +nuitka-crash-report.xml # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/dnfs/_run.sh b/dnfs/_run.sh index 7be4ff4..4c0aa75 100755 --- a/dnfs/_run.sh +++ b/dnfs/_run.sh @@ -2,4 +2,5 @@ cd "$(dirname "$0")" || exit bash ./_setup.sh source ./.env/bin/activate -exec python dnfs.py +#exec ./dnfs.bin +exec python3 dnfs.py diff --git a/dnfs/_setup.sh b/dnfs/_set.sh similarity index 85% rename from dnfs/_setup.sh rename to dnfs/_set.sh index cc0b017..2ba8dd3 100755 --- a/dnfs/_setup.sh +++ b/dnfs/_set.sh @@ -4,3 +4,4 @@ python3 -m venv .env #sudo chmod +x .env/bin/activate source .env/bin/activate pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple +nuitka --onefile --jobs=1 dnfs.py diff --git a/dnfs/index.html b/dnfs/index.html new file mode 100644 index 0000000..44262df --- /dev/null +++ b/dnfs/index.html @@ -0,0 +1,144 @@ + + +
+ + +点击或拖拽文件到此处上传
+文件将以编码形式保存,同一节点内数据不要超过1M
+ +加载中...
Python
- -发布时间:2026-07-11
-
- Python 的 socket
- 模块是网络编程的核心,其函数可分为核心套接字操作、套接字选项设置、辅助工具函数三大类。本文将逐一拆解所有函数的语法、参数、用法和实战示例,覆盖从基础到高级的所有场景。
-
语法:
-socket.socket(family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None)
- 作用:创建一个套接字对象,是所有网络操作的基础。
-参数说明:
-| 参数 | -取值 | -说明 | -
|---|---|---|
family |
- AF_INET(默认) |
- IPv4 协议族(最常用) | -
| - | AF_INET6 |
- IPv6 协议族 | -
| - | AF_UNIX |
- Unix 域套接字(本地进程通信) | -
type |
- SOCK_STREAM(默认) |
- TCP 套接字(面向连接、可靠) | -
| - | SOCK_DGRAM |
- UDP 套接字(无连接、数据报) | -
| - | SOCK_RAW |
- 原始套接字(可操作 IP 层,用于抓包) | -
proto |
- 0(默认) | -协议编号,默认自动匹配 type(TCP=6,UDP=17) | -
fileno |
- None(默认) | -复用已有文件描述符,无需手动指定 | -