示例#1
0
// Use Dial to connect to a server and read messages from it.
func ExampleDial() {
	conn, err := npipe.Dial(`\\.\pipe\mypipe`)
	if err != nil {
		// handle error
	}
	if _, err := fmt.Fprintln(conn, "Hi server!"); err != nil {
		// handle error
	}
	r := bufio.NewReader(conn)
	msg, err := r.ReadString('\n')
	if err != nil {
		// handle eror
	}
	fmt.Println(msg)
}
func connect(pathName string) (net.Conn, error) {
	return npipe.Dial(pathName)
}
示例#3
0
func (s SocketNamedPipe) DialSocket() (ret net.Conn, err error) {
	return npipe.Dial(s.pipename)
}
示例#4
0
func Connect(network, path string) (net.Conn, error) {
	return npipe.Dial(path)
}
示例#5
0
func (s SocketInfo) DialSocket() (ret net.Conn, err error) {
	return npipe.Dial(s.file)
}