[python-win32] win32file and win32pipe

Jens B. Jorgensen jens.jorgensen at tallan.com
Tue Apr 20 15:44:33 EDT 2004


I dunno about this Neil but I've used a named pipe with the win32 
extensions before and it worked fine for me. Are you sure you aren't 
supposed to send through some kind of command terminator?

Neil Benn wrote:

> 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
>


-- 
Jens B. Jorgensen
jens.jorgensen at tallan.com

"With a focused commitment to our clients and our people, we deliver value through customized technology solutions"  

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3108 bytes
Desc: S/MIME Cryptographic Signature
Url : http://mail.python.org/pipermail/python-win32/attachments/20040420/c6bf6d1d/smime.bin


More information about the Python-win32 mailing list