全部 新建

user:thomas 由用户创建的 Gists

title:mygist 包含指定标题的 Gists

filename:myfile.txt 包含指定文件名的 Gists

extension:yml 包含指定扩展名的 Gists

language:go 包含指定编程语言的 Gists

topic:homelab 具有给定主题的 Gists

登录


全部 新建 登录

所有匹配主题的 Gist ipc

最近 创建
最早 创建
最近 更新
最早 更新

timmy / 使用 zmq 進行跨進程或分散式訊息傳遞

0 喜欢
0 派生
2 文件
最后活跃于 9 months ago
zmq(ZeroMQ)是一個高效能的訊息佇列庫,可用於進程間通訊(IPC)、分散式系統與即時訊息傳輸,適用於微服務架構、物聯網(IoT)和高效能計算應用。
distributed-systems ipc messaging networking python zmq
1 import zmq
2
3 # 設置 ZeroMQ 上下文
4 context = zmq.Context()
5 socket = context.socket(zmq.REP) # 設定為回應 (REP) 模式
6 socket.bind("tcp://*:5555") # 監聽 5555 埠口
7
8 print("伺服器啟動,等待客戶端請求...")
9
10 while True:

timmy / 使用 multiprocessing.Pipe 進行進程間通訊

0 喜欢
0 派生
1 文件
最后活跃于 9 months ago
multiprocessing.Pipe 允許 Python 進程之間傳遞資料,適用於需要高效能、雙向通訊的場景,如併發運算或分佈式處理。
concurrency ipc multiprocessing parallel-processing pipe python
1 from multiprocessing import Process, Pipe
2
3 def worker(conn):
4 conn.send("Hello from child process") # 傳送訊息
5 msg = conn.recv() # 接收訊息
6 print(f"Child received: {msg}")
7 conn.close()
8
9 if __name__ == "__main__":
10 parent_conn, child_conn = Pipe() # 建立 Pipe 雙向通道
上一页 下一页

由 Opengist 强力驱动 ⋅ Load: 63ms⋅

中文
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文