#talk with windows named pipes

1 messages · Page 1 of 1 (latest)

coral linden
#

is there anything in the stdlib that would be able to open/use named pipes on windows? ideally with the same style of API thats available with std.net.connectUnixSocket

versed otter
#

not really, but CreateNamedPipe is bound in std.os.windows.kernel32

#

is there a reason you don't want to use unix sockets?

coral linden
#

i dont have an option im talking with an existing pipe, im not creating one

versed otter
#

you connect to a named pipe by opening a file with the name of the pipe

coral linden
#

so could i use a normal reader/writer on a std.fs.File?

versed otter
#

yes

coral linden
#

oh sick that makes my life a lot easier

#

means minimal code change on my end to support both

versed otter
#

just don't try to use the seeking facilities, they'll likely complain

coral linden
#

what about peeking? how do i peek for more data

versed otter
#

use a peekStream

coral linden
#

cus i need to know (non-blockingly) whether there is data for me

versed otter
#

streams in general are not peekable because as soon as you see a byte it's been consumed

coral linden
#

i dont want to know the data, only if there is data waiting for me

versed otter
#

that's not available in the std apis

coral linden
#

yeah on linux i call into ioctl to get that info on the unix socket, is there a way to do it on windows?

#

is ioctl a thing on windows?

versed otter
#

not that im aware of

coral linden
#

damn, i'll have to research more