Import std.net.ipc
IpcStream
class
Public Class IpcStream Implements Reader, Writer
A connection to an IpcListener: bytes both ways, in order, which it reads and writes as std.io's streams do. A Read or Write that fails throws an IOError whose Cause is a NetError or a TimeoutError. It closes when it goes, or at Close, which the other side reads as its end. A named pipe can't end one way only, so it has no ShutdownWrite, as a TcpStream has.
Examples
Local stream = Try IpcStream.Connect("example-app")
Try stream.WriteText("hello")
Print(Try ReadAllText(stream))
stream.Close()-
@PanicsAtCaller Public Static Method Connect(name: String, timeout: Duration? = Null): IpcStream Throws NetError, TimeoutErrorstatic method #Connects to the IpcListener of
name, waiting up totimeout, or as long as it takes for a Null one. Throws a NetError of REFUSED when nothing listens at it, and a TimeoutError when it takes too long. A name that isn't one panics. -
@PanicsAtCaller Public Static Async Method ConnectAsync(name: String, timeout: Duration? = Null): IpcStream Throws NetError, TimeoutErrorstatic method #Connect's Async twin, which waits on the main thread.
-
The name of the listener it's connected to, or that it came to.
-
How long a Read or ReadAsync waits for bytes before it throws, or Null, as it starts, to wait as long as it takes.
-
Whether Close closed it.
-
Reads what's come, at least a byte, waiting for some, or 0 once the other side ended what it writes.
-
Read's Async twin, which waits on the I/O thread for the connection's bytes while the main thread goes on.
-
Writes all of from's bytes, returning once the OS has them.
-
Write's Async twin, which waits on the I/O thread while the connection's bytes go, while the main thread goes on.
-
Closes it at once: a Read or Write waiting for it throws an IOError whose Cause is a NetError of CLOSED, and so does one after. Going closes it too.
Report an issue with this page or with FutureBlitz on GitHub.