Named pipe server under Pythonscript



  • Hello. What are the chances that anyone has implemented a named-pipe-server using ctypes under Pythonscript? Probably extremely low, but…if you have maybe you can offer me some advice.

    I’m basically trying to get this server/client example code going: http://code.activestate.com/lists/python-list/446422/
    It works “normally” (with its sample client), meaning when run using non-Pythonscript Python.

    But when I try it under Notepad++'s Pythonscript, odd things (hangs, huge delays) seem to happen after this line is executed in the server:
    fConnected = windll.kernel32.ConnectNamedPipe(hPipe, None)

    I’m not sure why this is, as I would think that this Python should be very much the same as other Python implementations when it comes to this. Thanks in advance for any help, but I feel it is probably a very long shot that I’ll get any. :)



  • @Alan-Kilborn

    never tried using named pipes, prefer using sockets.
    From the code itself I can’t see any obvious pitfall other than
    “how to stop the server in a safe way”.
    Did you try the code without any other python script active?
    How did you start client and server? Obviously not via python script
    plugin at the same time.

    Cheers
    Claudia



  • @Claudia-Frank

    Ah, Claudia! Always the one with the good ideas. I could look into sockets to do the communication I’m desiring, as a fallback plan. I think you’ll remember asking me if I had any more difficult Pythonscript things a couple of weeks ago–maybe this qualifies.

    Anyway, when something doesn’t work, I get curious as to why, so while I can give sockets a try, I’m still curious about the named pipe server running in PS. BTW, I did get it to run under PS as a named pipe client, but my overall design is better for what I’m doing if PS runs the server.

    So, OK, here we go…answers to your questions: I had nothing else running in PS when trying the server stuff out. My plan was to get the server started in PS, then run a client from something other than PS…for example, a plain old CMD.exe window. Since I couldn’t get the server to start, running the client was irrelevant, but I know you are asking because I might be doing something questionable like running both from PS.

    Can you try the server code? Should be easy to try because I don’t think I changed it at all from what is on that website before running it.



  • @Alan-Kilborn

    Copy and paste (reformatted line breaks) from activestate.
    Server via python script and client via nppexec
    As you see, I run the client 5 times and the message appeared immediately.
    Still can work with npp without delay/freezing.

    Can you execute commands in the console when running the server?
    How do you start it via Python Script menu? Or via a proxy script and execfile?
    Other different way?


Log in to reply