1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 // Pipe creates a synchronous, in-memory, full duplex
14 // network connection; both ends implement the Conn interface.
15 // Reads on one end are matched with writes on the other,
16 // copying data directly between the two; there is no internal
18 func Pipe() (Conn, Conn) {
22 return &pipe{r1, w2}, &pipe{r2, w1}
32 func (pipeAddr) Network() string {
36 func (pipeAddr) String() string {
40 func (p *pipe) Close() error {
41 err := p.PipeReader.Close()
42 err1 := p.PipeWriter.Close()
49 func (p *pipe) LocalAddr() Addr {
53 func (p *pipe) RemoteAddr() Addr {
57 func (p *pipe) SetDeadline(t time.Time) error {
58 return errors.New("net.Pipe does not support deadlines")
61 func (p *pipe) SetReadDeadline(t time.Time) error {
62 return errors.New("net.Pipe does not support deadlines")
65 func (p *pipe) SetWriteDeadline(t time.Time) error {
66 return errors.New("net.Pipe does not support deadlines")