#๐Ÿ”’ Issues with Win32 and Named Pipes

5 messages ยท Page 1 of 1 (latest)

lime harbor
#

Im currently making a named pipes system (server and client) for a much bigger project of mine. The goal is to create a Inter-Process Communication system that would allow multiple sub-system to communicate to each other.

In my IPC system i wanted to use Sockets but i use a Windows 11 system (i want it to be able to work on windows and linux, but linux seems easier with this stuff, so in this example im just focusing on windows) so i decided to use Named Pipes specifically from the Win32 Library. Im trying to make it similar to how websocket servers/clients work. The problem i seem to be having is with win32pipe's ReadFile method. It blocks the entire thread until it gets something from the pipe. Im tried to use asyncio's wait_for function, or there tasks system to basically timeout the function if it is taking too long, but all has failed. Here is the code:

server.py = https://pastebin.com/JmCqK6Rc
client.py = https://pastebin.com/vbTDeaP7

You must run server.py first then client.py (gonna fix it later). Also once its running, you are going to be prompted to send data between (on both scripts), but the issue on display here is how nether side will receive what gets sent. I dont know why its doing that, probably my limited knowledge of asyncio. If anyone could help me fix this, guide me to solving this, or just flat out telling me a better way to do all of this, i would be happy to listen. After you send that data, you can press enter again to close each side (both need to be off for it to close, again, gonna fix it eventually, im really tired ๐Ÿ˜ญ)

If you need me to explain something, let me know.

wicked sunBOT
#

@lime harbor

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

lime harbor
#

Just to be clear as im not sure if i was before, my issue is that fact that any data sent during the hander thread loop (the __anext__ part in either scripts) isnt being received when i try and use the timing out stuff (asyncio wait_for). If you can fix the other issues mentioned above, great, but the main issue is just the reading. Or give me alternate ideas that would actually work lol.

wicked sunBOT
#

@lime harbor

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.