import win32pipe, win32file, pywintypes
def recv():
print("pipe recv")
quit = False
while not quit:
try:
handle = win32pipe.CreateNamedPipe(
# r'\\.\pipe\Foo',
r'\\.\\Pipe\\mypipe',
win32pipe.PIPE_ACCESS_DUPLEX,
win32pipe.PIPE_TYPE_MESSAGE | win32pipe.PIPE_READMODE_MESSAGE | win32pipe.PIPE_WAIT,
1, 65536, 65536,
0,
None)
win32pipe.ConnectNamedPipe(handle, None)
while True:
with torch.no_grad():
#resp = win32file.ReadFile(handle, 320*240*4)[1]
win32file.WriteFile(handle, some_data)
except pywintypes.error as e:
if e.args[0] == 2:
print("no pipe, trying again in a sec")
python与C++通过命名管道通讯
最新推荐文章于 2025-07-03 11:25:35 发布