Pipes for local IPC

1,037 views
Skip to first unread message

Archos

unread,
Mar 16, 2012, 3:24:14 AM3/16/12
to golang-nuts
Does anybody has built a server using os.Pipe? Is it reliable in
Windows?

Kyle Lemons

unread,
Mar 16, 2012, 12:41:09 PM3/16/12
to Archos, golang-nuts
For what are you using it?  I've used syscall to create an extra, nonstandard pipe for an exec'd subprocess, but you can't do that with os.Pipe iirc.  I've used FIFOs in a server (also to communicate with a subprocess), which might be what you want, but I don't know if there's a windows equivalent.

roger peppe

unread,
Mar 16, 2012, 12:51:33 PM3/16/12
to Kyle Lemons, Archos, golang-nuts
On 16 March 2012 16:41, Kyle Lemons <kev...@google.com> wrote:
> For what are you using it?  I've used syscall to create an extra,
> nonstandard pipe for an exec'd subprocess, but you can't do that with
> os.Pipe iirc.

just passing an os.Pipe as stdin or stdout or both should work fine,
i'd've thought.

Archos

unread,
Mar 16, 2012, 12:58:50 PM3/16/12
to golang-nuts
It's for IPC. It isn't finished but it sshould be a full-duplex pipes
server handling multiple clients:

https://github.com/kless/GoServe/blob/master/serve/pipe.go

I use two named pipes to handle the initial conection with the
clients, then the server sends to the client 2 (anonymous) pipes
(using os.Pipe()) to follow with the communication, and to allows
multiple-clients.

I thought that os library was cross-system so os.Pipe should works in
Windows too. Does anybody coul confirm it?

Kyle Lemons

unread,
Mar 16, 2012, 2:03:57 PM3/16/12
to roger peppe, Archos, golang-nuts
I was using fds 3 and 7.

Kyle Lemons

unread,
Mar 16, 2012, 2:06:48 PM3/16/12
to Archos, golang-nuts
It looks like you're using os.Pipe where an io.Pipe would do.

Archos

unread,
Mar 16, 2012, 2:31:02 PM3/16/12
to golang-nuts
But I want that my local server can be accessed from another languages
so I've to use pipes based in files (for Windows systems).
Anyway, I didn't know about io.Pipe :)
Reply all
Reply to author
Forward
0 new messages