[python-win32] win32file and win32pipe

Neil Benn benn at cenix-bioscience.com
Tue Apr 20 12:50:28 EDT 2004


Hello,

          I'm doing some work on windows pipe to communicate with a 
commercial app (i.e. one which I have no source for), I'm using the 
commands as follows :

            hndPipe = win32file.CreateFile(r"\\.\pipe\gemini",
                                                  win32file.GENERIC_READ | \
                                                  win32file.GENERIC_WRITE,
                                                  0, #no sharing
                                                  None, #no security
                                                  win32file.OPEN_EXISTING,
                                                  
win32file.FILE_ATTRIBUTE_NORMAL,
                                                  None)

    This connects fine, then I write to the pipe using something like :

                win32file.WriteFile(self.__hndPipe, 'GET_VERSION', None)

    Again this works fine and the response is what I'd expect, however 
when I then send something like :

                win32file.WriteFile(self.__hndPipe, 'INIT_RSP', None)

    The external software thinks it has recevied :

    INIT_RSPION

    In other words it seems like the string variable used in win32file 
is not being cleaned out after the first call.  When I use something 
like CallNamedPipe in win32pipe it works fine, only problem with this is 
that it opens and closes the pipe all the time, which if the software is 
meant to be running 24/7 will make a mess of the logfiles and isn't the 
most elegent solution.

    I guess the question is, has anyone tried to do this, as it points 
towards an internal bug in the win32file C code.  Obviously I have 
tested the application with other pipe writing programs and it works 
without a problem.

    Thanks, in advance for your help.

Cheers,

Neil

-- 

Neil Benn
Senior Automation Engineer
Cenix BioScience
PfotenhauerStrasse 108
D-01307
Dresden
Germany

Tel : +49 (351) 210 1300
e-mail : benn at cenix-bioscience.com
Cenix Website : http://www.cenix-bioscience.com




More information about the Python-win32 mailing list