createNamedPipe in python

前端 未结 1 369
广开言路
广开言路 2020-12-06 02:37

hello I have two python files(namedpipe)

a.py

import win32pipe, win32file

p = win32pipe.CreateNamedPipe(r\'\\\\.\\pipe\\test_pipe\         


        
1条回答
  •  庸人自扰
    2020-12-06 03:42

    That's just what win32file.ReadFile() returns. It returns a tuple of the result and the read data. You should verify the result is 0 (or anything else applicable) and then read the data.

    data = win32file.ReadFile(fileHandle, 4096)
    if data[0] == 0:
      print data[1]
    else:
      print 'ERROR', data[0]
    

    0 讨论(0)
提交回复
热议问题