Send arbitrary Python objects via websockets
Project description
SocketMan
- 通过socket进行进程或python脚本间通信
- 可传输python对象
- 通过命名而非端口号管理和分配端口
- 自动查找可用端口
- 简单数据加密
- 试验用途, 请勿在生产环境中使用
安装
pip install socketman
使用
- 一个程序间通信的样例
# script_A
from socketman import autoConnect
def handle_recieve( eventparams ):
print(eventparams)
rconn.send({'reciverd':eventparams['obj']})
conn = autoConnect('端口a')
conn.autorecv(handle_recieve) # 自动接收消息
# script_B
from socketman import autoConnect
conn = autoConnect('端口a')
conn.send({'test':'obj'})
print(conn.recv())
conn.close()
进阶使用
import socketman
conn = autoConnect(pname='端口a', passwd='abcde', ptype=socketman.PType.p2p, host='localhost')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
socketman-0.4.0.tar.gz
(8.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
socketman-0.4.0-py3-none-any.whl
(23.2 kB
view details)
File details
Details for the file socketman-0.4.0.tar.gz.
File metadata
- Download URL: socketman-0.4.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
151ffb8cb76dffaeb88716cd68c385e28de7db99c1e2538e4d481e827e5db227
|
|
| MD5 |
832c79b03d0c7ddf308e80092aef232c
|
|
| BLAKE2b-256 |
27a29a329b908b3f6b30f67631fdb15760ab67d4f3fb6b680fd236958a9540b5
|
File details
Details for the file socketman-0.4.0-py3-none-any.whl.
File metadata
- Download URL: socketman-0.4.0-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcd889dc6661c421d3772ddfd9b97a1e5b1d46fb3ee31debd485a54fdee7cb1c
|
|
| MD5 |
1dda5d1c21327510272732dec180c1a4
|
|
| BLAKE2b-256 |
92b909f48136c0e242cb8e366ab3945aaed00ac2511107691a9fcb11640d1d9c
|