socketpair

package module
v0.0.0-...-c2c6a7f Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2017 License: BSD-3-Clause Imports: 4 Imported by: 1

Image README

socketpair TravisCI Go Report Card GoDoc

This is a simple package for Go that provides an interface to socketpair(2).

Usage

import "github.com/prep/socketpair"
func testSocketPair() error {
    sock1, sock2, err := socketpair.New("unix")
    if err != nil {
        return err
    }

    defer sock1.Close()
    defer sock2.Close()

    if _, err := sock1.Write([]byte("Hello World")); err != nil {
        return err
    }

    data := make([]byte, 11)
    if _, err := sock2.Read(data); err != nil {
        return err
    }

    return nil
}

License

This software is distributed under the BSD-style license found in the LICENSE file.

Image Documentation

Overview

Package socketpair implements a simple interface to create a socket pair.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(network string) (net.Conn, net.Conn, error)

New creates a socketpair of the specified network type.

Known networks are "unix" and "unixgram".

Types

This section is empty.

Jump to

Keyboard shortcuts

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