pipeconn

package module
v0.0.0-...-28a894b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

README

pipeconn 用标准输入输出和管道模拟 io.ReadWriteCloser

用标准输入输出和管道模拟 io.ReadWriteCloser,可以用于编写不依靠网络连接的 rpc server/client。

服务器方建立连接时调用pipeconn.NewServerPipeConn()

客户端建立连接时调用NewClientPipeConn(progPath , args...)

rpc 目录中的是一个示例程序。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClientPipeConn

func NewClientPipeConn(prog string, args ...string) (io.ReadWriteCloser, error)

NewClientPipeConn 运行 prog, 返回管道构成的 io.ReadWriteCloser

func NewServerPipeConn

func NewServerPipeConn() io.ReadWriteCloser

NewServerPipeConn 返回由 stdin、stdout 构成的 io.ReadWriteCloser

Types

type ClientPipeConn

type ClientPipeConn struct {
	// contains filtered or unexported fields
}

func (*ClientPipeConn) Close

func (s *ClientPipeConn) Close() error

func (*ClientPipeConn) Read

func (s *ClientPipeConn) Read(p []byte) (int, error)

func (*ClientPipeConn) Write

func (s *ClientPipeConn) Write(p []byte) (int, error)

type ServerPipeConn

type ServerPipeConn struct{}

func (*ServerPipeConn) Close

func (s *ServerPipeConn) Close() error

func (*ServerPipeConn) Read

func (s *ServerPipeConn) Read(p []byte) (int, error)

func (*ServerPipeConn) Write

func (s *ServerPipeConn) Write(p []byte) (int, error)

Directories

Path Synopsis
golang 标准 rpc 返回结构体时,如果某个结构体成员为零值,那么返回时该成员变量会被自动忽略。
golang 标准 rpc 返回结构体时,如果某个结构体成员为零值,那么返回时该成员变量会被自动忽略。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL