You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

4550 lines
156 KiB

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#375EAB">
<title>net - The Go Programming Language</title>
<link type="text/css" rel="stylesheet" href="../../lib/godoc/style.css">
<link rel="stylesheet" href="../../lib/godoc/jquery.treeview.css">
<script type="text/javascript">window.initFuncs = [];</script>
</head>
<body>
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;">
...
</div><!-- #lowframe -->
<div id="topbar" class="wide"><div class="container">
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div>
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div>
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">&#9661;</span></a>
<form method="GET" action="http://localhost:6060/search">
<div id="menu">
<a href="http://localhost:6060/doc/">Documents</a>
<a href="http://localhost:6060/pkg/">Packages</a>
<a href="http://localhost:6060/project/">The Project</a>
<a href="http://localhost:6060/help/">Help</a>
<a href="http://localhost:6060/blog/">Blog</a>
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search">
</div>
</form>
</div></div>
<div id="page" class="wide">
<div class="container">
<h1>Package net</h1>
<div id="nav"></div>
<!--
Copyright 2009 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
<!--
Note: Static (i.e., not template-generated) href and id
attributes start with "pkg-" to make it impossible for
them to conflict with generated attributes (some of which
correspond to Go identifiers).
-->
<script type='text/javascript'>
document.ANALYSIS_DATA = null;
document.CALLGRAPH = null;
</script>
<div id="short-nav">
<dl>
<dd><code>import "net"</code></dd>
</dl>
<dl>
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd>
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd>
<dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd>
<dd><a href="index.html#pkg-subdirectories">Subdirectories</a></dd>
</dl>
</div>
<!-- The package's Name is printed as title by the top-level template -->
<div id="pkg-overview" class="toggleVisible">
<div class="collapsed">
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
</div>
<div class="expanded">
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
<p>
Package net provides a portable interface for network I/O, including
TCP/IP, UDP, domain name resolution, and Unix domain sockets.
</p>
<p>
Although the package provides access to low-level networking
primitives, most clients will need only the basic interface provided
by the Dial, Listen, and Accept functions and the associated
Conn and Listener interfaces. The crypto/tls package uses
the same interfaces and similar Dial and Listen functions.
</p>
<p>
The Dial function connects to a server:
</p>
<pre>conn, err := net.Dial(&#34;tcp&#34;, &#34;google.com:80&#34;)
if err != nil {
// handle error
}
fmt.Fprintf(conn, &#34;GET / HTTP/1.0\r\n\r\n&#34;)
status, err := bufio.NewReader(conn).ReadString(&#39;\n&#39;)
// ...
</pre>
<p>
The Listen function creates servers:
</p>
<pre>ln, err := net.Listen(&#34;tcp&#34;, &#34;:8080&#34;)
if err != nil {
// handle error
}
for {
conn, err := ln.Accept()
if err != nil {
// handle error
}
go handleConnection(conn)
}
</pre>
<h3 id="hdr-Name_Resolution">Name Resolution</h3>
<p>
The method for resolving domain names, whether indirectly with functions like Dial
or directly with functions like LookupHost and LookupAddr, varies by operating system.
</p>
<p>
On Unix systems, the resolver has two options for resolving names.
It can use a pure Go resolver that sends DNS requests directly to the servers
listed in /etc/resolv.conf, or it can use a cgo-based resolver that calls C
library routines such as getaddrinfo and getnameinfo.
</p>
<p>
By default the pure Go resolver is used, because a blocked DNS request consumes
only a goroutine, while a blocked C call consumes an operating system thread.
When cgo is available, the cgo-based resolver is used instead under a variety of
conditions: on systems that do not let programs make direct DNS requests (OS X),
when the LOCALDOMAIN environment variable is present (even if empty),
when the RES_OPTIONS or HOSTALIASES environment variable is non-empty,
when the ASR_CONFIG environment variable is non-empty (OpenBSD only),
when /etc/resolv.conf or /etc/nsswitch.conf specify the use of features that the
Go resolver does not implement, and when the name being looked up ends in .local
or is an mDNS name.
</p>
<p>
The resolver decision can be overridden by setting the netdns value of the
GODEBUG environment variable (see package runtime) to go or cgo, as in:
</p>
<pre>export GODEBUG=netdns=go # force pure Go resolver
export GODEBUG=netdns=cgo # force cgo resolver
</pre>
<p>
The decision can also be forced while building the Go source tree
by setting the netgo or netcgo build tag.
</p>
<p>
A numeric netdns setting, as in GODEBUG=netdns=1, causes the resolver
to print debugging information about its decisions.
To force a particular resolver while also printing debugging information,
join the two settings by a plus sign, as in GODEBUG=netdns=go+1.
</p>
<p>
On Plan 9, the resolver always accesses /net/cs and /net/dns.
</p>
<p>
On Windows, the resolver always uses C library functions, such as GetAddrInfo and DnsQuery.
</p>
</div>
</div>
<div id="pkg-index" class="toggleVisible">
<div class="collapsed">
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
</div>
<div class="expanded">
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
<div id="manual-nav">
<dl>
<dd><a href="index.html#pkg-constants">Constants</a></dd>
<dd><a href="index.html#pkg-variables">Variables</a></dd>
<dd><a href="index.html#InterfaceAddrs">func InterfaceAddrs() ([]Addr, error)</a></dd>
<dd><a href="index.html#Interfaces">func Interfaces() ([]Interface, error)</a></dd>
<dd><a href="index.html#JoinHostPort">func JoinHostPort(host, port string) string</a></dd>
<dd><a href="index.html#LookupAddr">func LookupAddr(addr string) (names []string, err error)</a></dd>
<dd><a href="index.html#LookupCNAME">func LookupCNAME(name string) (cname string, err error)</a></dd>
<dd><a href="index.html#LookupHost">func LookupHost(host string) (addrs []string, err error)</a></dd>
<dd><a href="index.html#LookupIP">func LookupIP(host string) (ips []IP, err error)</a></dd>
<dd><a href="index.html#LookupMX">func LookupMX(name string) (mxs []*MX, err error)</a></dd>
<dd><a href="index.html#LookupNS">func LookupNS(name string) (nss []*NS, err error)</a></dd>
<dd><a href="index.html#LookupPort">func LookupPort(network, service string) (port int, err error)</a></dd>
<dd><a href="index.html#LookupSRV">func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err error)</a></dd>
<dd><a href="index.html#LookupTXT">func LookupTXT(name string) (txts []string, err error)</a></dd>
<dd><a href="index.html#SplitHostPort">func SplitHostPort(hostport string) (host, port string, err error)</a></dd>
<dd><a href="index.html#Addr">type Addr</a></dd>
<dd><a href="index.html#AddrError">type AddrError</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#AddrError.Error">func (e *AddrError) Error() string</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#AddrError.Temporary">func (e *AddrError) Temporary() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#AddrError.Timeout">func (e *AddrError) Timeout() bool</a></dd>
<dd><a href="index.html#Conn">type Conn</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#Dial">func Dial(network, address string) (Conn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#DialTimeout">func DialTimeout(network, address string, timeout time.Duration) (Conn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#FileConn">func FileConn(f *os.File) (c Conn, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#Pipe">func Pipe() (Conn, Conn)</a></dd>
<dd><a href="index.html#DNSConfigError">type DNSConfigError</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#DNSConfigError.Error">func (e *DNSConfigError) Error() string</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#DNSConfigError.Temporary">func (e *DNSConfigError) Temporary() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#DNSConfigError.Timeout">func (e *DNSConfigError) Timeout() bool</a></dd>
<dd><a href="index.html#DNSError">type DNSError</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#DNSError.Error">func (e *DNSError) Error() string</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#DNSError.Temporary">func (e *DNSError) Temporary() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#DNSError.Timeout">func (e *DNSError) Timeout() bool</a></dd>
<dd><a href="index.html#Dialer">type Dialer</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#Dialer.Dial">func (d *Dialer) Dial(network, address string) (Conn, error)</a></dd>
<dd><a href="index.html#Error">type Error</a></dd>
<dd><a href="index.html#Flags">type Flags</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#Flags.String">func (f Flags) String() string</a></dd>
<dd><a href="index.html#HardwareAddr">type HardwareAddr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ParseMAC">func ParseMAC(s string) (hw HardwareAddr, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#HardwareAddr.String">func (a HardwareAddr) String() string</a></dd>
<dd><a href="index.html#IP">type IP</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPv4">func IPv4(a, b, c, d byte) IP</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ParseCIDR">func ParseCIDR(s string) (IP, *IPNet, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ParseIP">func ParseIP(s string) IP</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.DefaultMask">func (ip IP) DefaultMask() IPMask</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.Equal">func (ip IP) Equal(x IP) bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.IsGlobalUnicast">func (ip IP) IsGlobalUnicast() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.IsInterfaceLocalMulticast">func (ip IP) IsInterfaceLocalMulticast() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.IsLinkLocalMulticast">func (ip IP) IsLinkLocalMulticast() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.IsLinkLocalUnicast">func (ip IP) IsLinkLocalUnicast() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.IsLoopback">func (ip IP) IsLoopback() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.IsMulticast">func (ip IP) IsMulticast() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.IsUnspecified">func (ip IP) IsUnspecified() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.MarshalText">func (ip IP) MarshalText() ([]byte, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.Mask">func (ip IP) Mask(mask IPMask) IP</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.String">func (ip IP) String() string</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.To16">func (ip IP) To16() IP</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.To4">func (ip IP) To4() IP</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IP.UnmarshalText">func (ip *IP) UnmarshalText(text []byte) error</a></dd>
<dd><a href="index.html#IPAddr">type IPAddr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ResolveIPAddr">func ResolveIPAddr(net, addr string) (*IPAddr, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPAddr.Network">func (a *IPAddr) Network() string</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPAddr.String">func (a *IPAddr) String() string</a></dd>
<dd><a href="index.html#IPConn">type IPConn</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#DialIP">func DialIP(netProto string, laddr, raddr *IPAddr) (*IPConn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ListenIP">func ListenIP(netProto string, laddr *IPAddr) (*IPConn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.Close">func (c *IPConn) Close() error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.File">func (c *IPConn) File() (f *os.File, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.LocalAddr">func (c *IPConn) LocalAddr() Addr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.Read">func (c *IPConn) Read(b []byte) (int, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.ReadFrom">func (c *IPConn) ReadFrom(b []byte) (int, Addr, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.ReadFromIP">func (c *IPConn) ReadFromIP(b []byte) (int, *IPAddr, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.ReadMsgIP">func (c *IPConn) ReadMsgIP(b, oob []byte) (n, oobn, flags int, addr *IPAddr, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.RemoteAddr">func (c *IPConn) RemoteAddr() Addr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.SetDeadline">func (c *IPConn) SetDeadline(t time.Time) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.SetReadBuffer">func (c *IPConn) SetReadBuffer(bytes int) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.SetReadDeadline">func (c *IPConn) SetReadDeadline(t time.Time) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.SetWriteBuffer">func (c *IPConn) SetWriteBuffer(bytes int) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.SetWriteDeadline">func (c *IPConn) SetWriteDeadline(t time.Time) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.Write">func (c *IPConn) Write(b []byte) (int, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.WriteMsgIP">func (c *IPConn) WriteMsgIP(b, oob []byte, addr *IPAddr) (n, oobn int, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.WriteTo">func (c *IPConn) WriteTo(b []byte, addr Addr) (int, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPConn.WriteToIP">func (c *IPConn) WriteToIP(b []byte, addr *IPAddr) (int, error)</a></dd>
<dd><a href="index.html#IPMask">type IPMask</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#CIDRMask">func CIDRMask(ones, bits int) IPMask</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPv4Mask">func IPv4Mask(a, b, c, d byte) IPMask</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPMask.Size">func (m IPMask) Size() (ones, bits int)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPMask.String">func (m IPMask) String() string</a></dd>
<dd><a href="index.html#IPNet">type IPNet</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPNet.Contains">func (n *IPNet) Contains(ip IP) bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPNet.Network">func (n *IPNet) Network() string</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#IPNet.String">func (n *IPNet) String() string</a></dd>
<dd><a href="index.html#Interface">type Interface</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#InterfaceByIndex">func InterfaceByIndex(index int) (*Interface, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#InterfaceByName">func InterfaceByName(name string) (*Interface, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#Interface.Addrs">func (ifi *Interface) Addrs() ([]Addr, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#Interface.MulticastAddrs">func (ifi *Interface) MulticastAddrs() ([]Addr, error)</a></dd>
<dd><a href="index.html#InvalidAddrError">type InvalidAddrError</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#InvalidAddrError.Error">func (e InvalidAddrError) Error() string</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#InvalidAddrError.Temporary">func (e InvalidAddrError) Temporary() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#InvalidAddrError.Timeout">func (e InvalidAddrError) Timeout() bool</a></dd>
<dd><a href="index.html#Listener">type Listener</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#FileListener">func FileListener(f *os.File) (ln Listener, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#Listen">func Listen(net, laddr string) (Listener, error)</a></dd>
<dd><a href="index.html#MX">type MX</a></dd>
<dd><a href="index.html#NS">type NS</a></dd>
<dd><a href="index.html#OpError">type OpError</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#OpError.Error">func (e *OpError) Error() string</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#OpError.Temporary">func (e *OpError) Temporary() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#OpError.Timeout">func (e *OpError) Timeout() bool</a></dd>
<dd><a href="index.html#PacketConn">type PacketConn</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#FilePacketConn">func FilePacketConn(f *os.File) (c PacketConn, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ListenPacket">func ListenPacket(net, laddr string) (PacketConn, error)</a></dd>
<dd><a href="index.html#ParseError">type ParseError</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ParseError.Error">func (e *ParseError) Error() string</a></dd>
<dd><a href="index.html#SRV">type SRV</a></dd>
<dd><a href="index.html#TCPAddr">type TCPAddr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ResolveTCPAddr">func ResolveTCPAddr(net, addr string) (*TCPAddr, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPAddr.Network">func (a *TCPAddr) Network() string</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPAddr.String">func (a *TCPAddr) String() string</a></dd>
<dd><a href="index.html#TCPConn">type TCPConn</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#DialTCP">func DialTCP(net string, laddr, raddr *TCPAddr) (*TCPConn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.Close">func (c *TCPConn) Close() error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.CloseRead">func (c *TCPConn) CloseRead() error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.CloseWrite">func (c *TCPConn) CloseWrite() error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.File">func (c *TCPConn) File() (f *os.File, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.LocalAddr">func (c *TCPConn) LocalAddr() Addr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.Read">func (c *TCPConn) Read(b []byte) (int, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.ReadFrom">func (c *TCPConn) ReadFrom(r io.Reader) (int64, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.RemoteAddr">func (c *TCPConn) RemoteAddr() Addr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.SetDeadline">func (c *TCPConn) SetDeadline(t time.Time) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.SetKeepAlive">func (c *TCPConn) SetKeepAlive(keepalive bool) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.SetKeepAlivePeriod">func (c *TCPConn) SetKeepAlivePeriod(d time.Duration) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.SetLinger">func (c *TCPConn) SetLinger(sec int) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.SetNoDelay">func (c *TCPConn) SetNoDelay(noDelay bool) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.SetReadBuffer">func (c *TCPConn) SetReadBuffer(bytes int) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.SetReadDeadline">func (c *TCPConn) SetReadDeadline(t time.Time) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.SetWriteBuffer">func (c *TCPConn) SetWriteBuffer(bytes int) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.SetWriteDeadline">func (c *TCPConn) SetWriteDeadline(t time.Time) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPConn.Write">func (c *TCPConn) Write(b []byte) (int, error)</a></dd>
<dd><a href="index.html#TCPListener">type TCPListener</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ListenTCP">func ListenTCP(net string, laddr *TCPAddr) (*TCPListener, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPListener.Accept">func (l *TCPListener) Accept() (Conn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPListener.AcceptTCP">func (l *TCPListener) AcceptTCP() (*TCPConn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPListener.Addr">func (l *TCPListener) Addr() Addr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPListener.Close">func (l *TCPListener) Close() error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPListener.File">func (l *TCPListener) File() (f *os.File, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#TCPListener.SetDeadline">func (l *TCPListener) SetDeadline(t time.Time) error</a></dd>
<dd><a href="index.html#UDPAddr">type UDPAddr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ResolveUDPAddr">func ResolveUDPAddr(net, addr string) (*UDPAddr, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPAddr.Network">func (a *UDPAddr) Network() string</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPAddr.String">func (a *UDPAddr) String() string</a></dd>
<dd><a href="index.html#UDPConn">type UDPConn</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#DialUDP">func DialUDP(net string, laddr, raddr *UDPAddr) (*UDPConn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ListenMulticastUDP">func ListenMulticastUDP(network string, ifi *Interface, gaddr *UDPAddr) (*UDPConn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ListenUDP">func ListenUDP(net string, laddr *UDPAddr) (*UDPConn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.Close">func (c *UDPConn) Close() error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.File">func (c *UDPConn) File() (f *os.File, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.LocalAddr">func (c *UDPConn) LocalAddr() Addr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.Read">func (c *UDPConn) Read(b []byte) (int, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.ReadFrom">func (c *UDPConn) ReadFrom(b []byte) (int, Addr, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.ReadFromUDP">func (c *UDPConn) ReadFromUDP(b []byte) (int, *UDPAddr, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.ReadMsgUDP">func (c *UDPConn) ReadMsgUDP(b, oob []byte) (n, oobn, flags int, addr *UDPAddr, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.RemoteAddr">func (c *UDPConn) RemoteAddr() Addr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.SetDeadline">func (c *UDPConn) SetDeadline(t time.Time) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.SetReadBuffer">func (c *UDPConn) SetReadBuffer(bytes int) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.SetReadDeadline">func (c *UDPConn) SetReadDeadline(t time.Time) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.SetWriteBuffer">func (c *UDPConn) SetWriteBuffer(bytes int) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.SetWriteDeadline">func (c *UDPConn) SetWriteDeadline(t time.Time) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.Write">func (c *UDPConn) Write(b []byte) (int, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.WriteMsgUDP">func (c *UDPConn) WriteMsgUDP(b, oob []byte, addr *UDPAddr) (n, oobn int, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.WriteTo">func (c *UDPConn) WriteTo(b []byte, addr Addr) (int, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UDPConn.WriteToUDP">func (c *UDPConn) WriteToUDP(b []byte, addr *UDPAddr) (int, error)</a></dd>
<dd><a href="index.html#UnixAddr">type UnixAddr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ResolveUnixAddr">func ResolveUnixAddr(net, addr string) (*UnixAddr, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixAddr.Network">func (a *UnixAddr) Network() string</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixAddr.String">func (a *UnixAddr) String() string</a></dd>
<dd><a href="index.html#UnixConn">type UnixConn</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#DialUnix">func DialUnix(net string, laddr, raddr *UnixAddr) (*UnixConn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ListenUnixgram">func ListenUnixgram(net string, laddr *UnixAddr) (*UnixConn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.Close">func (c *UnixConn) Close() error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.CloseRead">func (c *UnixConn) CloseRead() error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.CloseWrite">func (c *UnixConn) CloseWrite() error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.File">func (c *UnixConn) File() (f *os.File, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.LocalAddr">func (c *UnixConn) LocalAddr() Addr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.Read">func (c *UnixConn) Read(b []byte) (int, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.ReadFrom">func (c *UnixConn) ReadFrom(b []byte) (int, Addr, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.ReadFromUnix">func (c *UnixConn) ReadFromUnix(b []byte) (int, *UnixAddr, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.ReadMsgUnix">func (c *UnixConn) ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAddr, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.RemoteAddr">func (c *UnixConn) RemoteAddr() Addr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.SetDeadline">func (c *UnixConn) SetDeadline(t time.Time) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.SetReadBuffer">func (c *UnixConn) SetReadBuffer(bytes int) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.SetReadDeadline">func (c *UnixConn) SetReadDeadline(t time.Time) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.SetWriteBuffer">func (c *UnixConn) SetWriteBuffer(bytes int) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.SetWriteDeadline">func (c *UnixConn) SetWriteDeadline(t time.Time) error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.Write">func (c *UnixConn) Write(b []byte) (int, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.WriteMsgUnix">func (c *UnixConn) WriteMsgUnix(b, oob []byte, addr *UnixAddr) (n, oobn int, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.WriteTo">func (c *UnixConn) WriteTo(b []byte, addr Addr) (n int, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixConn.WriteToUnix">func (c *UnixConn) WriteToUnix(b []byte, addr *UnixAddr) (int, error)</a></dd>
<dd><a href="index.html#UnixListener">type UnixListener</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#ListenUnix">func ListenUnix(net string, laddr *UnixAddr) (*UnixListener, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixListener.Accept">func (l *UnixListener) Accept() (c Conn, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixListener.AcceptUnix">func (l *UnixListener) AcceptUnix() (*UnixConn, error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixListener.Addr">func (l *UnixListener) Addr() Addr</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixListener.Close">func (l *UnixListener) Close() error</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixListener.File">func (l *UnixListener) File() (f *os.File, err error)</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnixListener.SetDeadline">func (l *UnixListener) SetDeadline(t time.Time) error</a></dd>
<dd><a href="index.html#UnknownNetworkError">type UnknownNetworkError</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnknownNetworkError.Error">func (e UnknownNetworkError) Error() string</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnknownNetworkError.Temporary">func (e UnknownNetworkError) Temporary() bool</a></dd>
<dd>&nbsp; &nbsp; <a href="index.html#UnknownNetworkError.Timeout">func (e UnknownNetworkError) Timeout() bool</a></dd>
<dd><a href="index.html#pkg-note-BUG">Bugs</a></dd>
</dl>
</div><!-- #manual-nav -->
<div id="pkg-examples">
<h4>Examples</h4>
<dl>
<dd><a class="exampleLink" href="index.html#example_Listener">Listener</a></dd>
</dl>
</div>
<h4>Package files</h4>
<p>
<span style="font-size:90%">
<a href="http://localhost:6060/src/net/addrselect.go">addrselect.go</a>
<a href="http://localhost:6060/src/net/cgo_linux.go">cgo_linux.go</a>
<a href="http://localhost:6060/src/net/cgo_resnew.go">cgo_resnew.go</a>
<a href="http://localhost:6060/src/net/cgo_socknew.go">cgo_socknew.go</a>
<a href="http://localhost:6060/src/net/cgo_unix.go">cgo_unix.go</a>
<a href="http://localhost:6060/src/net/conf.go">conf.go</a>
<a href="http://localhost:6060/src/net/dial.go">dial.go</a>
<a href="http://localhost:6060/src/net/dnsclient.go">dnsclient.go</a>
<a href="http://localhost:6060/src/net/dnsclient_unix.go">dnsclient_unix.go</a>
<a href="http://localhost:6060/src/net/dnsconfig_unix.go">dnsconfig_unix.go</a>
<a href="http://localhost:6060/src/net/dnsmsg.go">dnsmsg.go</a>
<a href="http://localhost:6060/src/net/fd_mutex.go">fd_mutex.go</a>
<a href="http://localhost:6060/src/net/fd_poll_runtime.go">fd_poll_runtime.go</a>
<a href="http://localhost:6060/src/net/fd_posix.go">fd_posix.go</a>
<a href="http://localhost:6060/src/net/fd_unix.go">fd_unix.go</a>
<a href="http://localhost:6060/src/net/file.go">file.go</a>
<a href="http://localhost:6060/src/net/file_unix.go">file_unix.go</a>
<a href="http://localhost:6060/src/net/hook.go">hook.go</a>
<a href="http://localhost:6060/src/net/hook_cloexec.go">hook_cloexec.go</a>
<a href="http://localhost:6060/src/net/hook_unix.go">hook_unix.go</a>
<a href="http://localhost:6060/src/net/hosts.go">hosts.go</a>
<a href="http://localhost:6060/src/net/interface.go">interface.go</a>
<a href="http://localhost:6060/src/net/interface_linux.go">interface_linux.go</a>
<a href="http://localhost:6060/src/net/ip.go">ip.go</a>
<a href="http://localhost:6060/src/net/iprawsock.go">iprawsock.go</a>
<a href="http://localhost:6060/src/net/iprawsock_posix.go">iprawsock_posix.go</a>
<a href="http://localhost:6060/src/net/ipsock.go">ipsock.go</a>
<a href="http://localhost:6060/src/net/ipsock_posix.go">ipsock_posix.go</a>
<a href="http://localhost:6060/src/net/lookup.go">lookup.go</a>
<a href="http://localhost:6060/src/net/lookup_unix.go">lookup_unix.go</a>
<a href="http://localhost:6060/src/net/mac.go">mac.go</a>
<a href="http://localhost:6060/src/net/net.go">net.go</a>
<a href="http://localhost:6060/src/net/nss.go">nss.go</a>
<a href="http://localhost:6060/src/net/parse.go">parse.go</a>
<a href="http://localhost:6060/src/net/pipe.go">pipe.go</a>
<a href="http://localhost:6060/src/net/port_unix.go">port_unix.go</a>
<a href="http://localhost:6060/src/net/sendfile_linux.go">sendfile_linux.go</a>
<a href="http://localhost:6060/src/net/sock_cloexec.go">sock_cloexec.go</a>
<a href="http://localhost:6060/src/net/sock_linux.go">sock_linux.go</a>
<a href="http://localhost:6060/src/net/sock_posix.go">sock_posix.go</a>
<a href="http://localhost:6060/src/net/sockopt_linux.go">sockopt_linux.go</a>
<a href="http://localhost:6060/src/net/sockopt_posix.go">sockopt_posix.go</a>
<a href="http://localhost:6060/src/net/sockoptip_linux.go">sockoptip_linux.go</a>
<a href="http://localhost:6060/src/net/sockoptip_posix.go">sockoptip_posix.go</a>
<a href="http://localhost:6060/src/net/tcpsock.go">tcpsock.go</a>
<a href="http://localhost:6060/src/net/tcpsock_posix.go">tcpsock_posix.go</a>
<a href="http://localhost:6060/src/net/tcpsockopt_posix.go">tcpsockopt_posix.go</a>
<a href="http://localhost:6060/src/net/tcpsockopt_unix.go">tcpsockopt_unix.go</a>
<a href="http://localhost:6060/src/net/udpsock.go">udpsock.go</a>
<a href="http://localhost:6060/src/net/udpsock_posix.go">udpsock_posix.go</a>
<a href="http://localhost:6060/src/net/unixsock.go">unixsock.go</a>
<a href="http://localhost:6060/src/net/unixsock_posix.go">unixsock_posix.go</a>
</span>
</p>
</div><!-- .expanded -->
</div><!-- #pkg-index -->
<div id="pkg-callgraph" class="toggle" style="display: none">
<div class="collapsed">
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2>
</div> <!-- .expanded -->
<div class="expanded">
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2>
<p>
In the call graph viewer below, each node
is a function belonging to this package
and its children are the functions it
calls&mdash;perhaps dynamically.
</p>
<p>
The root nodes are the entry points of the
package: functions that may be called from
outside the package.
There may be non-exported or anonymous
functions among them if they are called
dynamically from another package.
</p>
<p>
Click a node to visit that function's source code.
From there you can visit its callers by
clicking its declaring <code>func</code>
token.
</p>
<p>
Functions may be omitted if they were
determined to be unreachable in the
particular programs or tests that were
analyzed.
</p>
<!-- Zero means show all package entry points. -->
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul>
</div>
</div> <!-- #pkg-callgraph -->
<h2 id="pkg-constants">Constants</h2>
<pre>const (
<span id="IPv4len">IPv4len</span> = 4
<span id="IPv6len">IPv6len</span> = 16
)</pre>
<p>
IP address lengths (bytes).
</p>
<h2 id="pkg-variables">Variables</h2>
<pre>var (
<span id="IPv4bcast">IPv4bcast</span> = <a href="index.html#IPv4">IPv4</a>(255, 255, 255, 255) <span class="comment">// broadcast</span>
<span id="IPv4allsys">IPv4allsys</span> = <a href="index.html#IPv4">IPv4</a>(224, 0, 0, 1) <span class="comment">// all systems</span>
<span id="IPv4allrouter">IPv4allrouter</span> = <a href="index.html#IPv4">IPv4</a>(224, 0, 0, 2) <span class="comment">// all routers</span>
<span id="IPv4zero">IPv4zero</span> = <a href="index.html#IPv4">IPv4</a>(0, 0, 0, 0) <span class="comment">// all zeros</span>
)</pre>
<p>
Well-known IPv4 addresses
</p>
<pre>var (
<span id="IPv6zero">IPv6zero</span> = <a href="index.html#IP">IP</a>{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
<span id="IPv6unspecified">IPv6unspecified</span> = <a href="index.html#IP">IP</a>{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
<span id="IPv6loopback">IPv6loopback</span> = <a href="index.html#IP">IP</a>{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
<span id="IPv6interfacelocalallnodes">IPv6interfacelocalallnodes</span> = <a href="index.html#IP">IP</a>{0xff, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01}
<span id="IPv6linklocalallnodes">IPv6linklocalallnodes</span> = <a href="index.html#IP">IP</a>{0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01}
<span id="IPv6linklocalallrouters">IPv6linklocalallrouters</span> = <a href="index.html#IP">IP</a>{0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02}
)</pre>
<p>
Well-known IPv6 addresses
</p>
<pre>var (
<span id="ErrWriteToConnected">ErrWriteToConnected</span> = <a href="../errors/index.html">errors</a>.<a href="../errors/index.html#New">New</a>(&#34;use of WriteTo with pre-connected connection&#34;)
)</pre>
<p>
Various errors contained in OpError.
</p>
<h2 id="InterfaceAddrs">func <a href="http://localhost:6060/src/net/interface.go?s=2948:2985#L88">InterfaceAddrs</a></h2>
<pre>func InterfaceAddrs() ([]<a href="index.html#Addr">Addr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
InterfaceAddrs returns a list of the system&#39;s network interface
addresses.
</p>
<h2 id="Interfaces">func <a href="http://localhost:6060/src/net/interface.go?s=2676:2714#L78">Interfaces</a></h2>
<pre>func Interfaces() ([]<a href="index.html#Interface">Interface</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Interfaces returns a list of the system&#39;s network interfaces.
</p>
<h2 id="JoinHostPort">func <a href="http://localhost:6060/src/net/ipsock.go?s=5302:5345#L182">JoinHostPort</a></h2>
<pre>func JoinHostPort(host, port <a href="../builtin/index.html#string">string</a>) <a href="../builtin/index.html#string">string</a></pre>
<p>
JoinHostPort combines host and port into a network address of the
form &#34;host:port&#34; or, if host contains a colon or a percent sign,
&#34;[host]:port&#34;.
</p>
<h2 id="LookupAddr">func <a href="http://localhost:6060/src/net/lookup.go?s=5485:5541#L172">LookupAddr</a></h2>
<pre>func LookupAddr(addr <a href="../builtin/index.html#string">string</a>) (names []<a href="../builtin/index.html#string">string</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
LookupAddr performs a reverse lookup for the given address, returning a list
of names mapping to that address.
</p>
<h2 id="LookupCNAME">func <a href="http://localhost:6060/src/net/lookup.go?s=4196:4251#L138">LookupCNAME</a></h2>
<pre>func LookupCNAME(name <a href="../builtin/index.html#string">string</a>) (cname <a href="../builtin/index.html#string">string</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
LookupCNAME returns the canonical DNS host for the given name.
Callers that do not care about the canonical name can call
LookupHost or LookupIP directly; both take care of resolving
the canonical name as part of the lookup.
</p>
<h2 id="LookupHost">func <a href="http://localhost:6060/src/net/lookup.go?s=724:780#L17">LookupHost</a></h2>
<pre>func LookupHost(host <a href="../builtin/index.html#string">string</a>) (addrs []<a href="../builtin/index.html#string">string</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
LookupHost looks up the given host using the local resolver.
It returns an array of that host&#39;s addresses.
</p>
<h2 id="LookupIP">func <a href="http://localhost:6060/src/net/lookup.go?s=1201:1249#L31">LookupIP</a></h2>
<pre>func LookupIP(host <a href="../builtin/index.html#string">string</a>) (ips []<a href="index.html#IP">IP</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
LookupIP looks up host using the local resolver.
It returns an array of that host&#39;s IPv4 and IPv6 addresses.
</p>
<h2 id="LookupMX">func <a href="http://localhost:6060/src/net/lookup.go?s=4994:5043#L156">LookupMX</a></h2>
<pre>func LookupMX(name <a href="../builtin/index.html#string">string</a>) (mxs []*<a href="index.html#MX">MX</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
LookupMX returns the DNS MX records for the given domain name sorted by preference.
</p>
<h2 id="LookupNS">func <a href="http://localhost:6060/src/net/lookup.go?s=5138:5187#L161">LookupNS</a></h2>
<pre>func LookupNS(name <a href="../builtin/index.html#string">string</a>) (nss []*<a href="index.html#NS">NS</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
LookupNS returns the DNS NS records for the given domain name.
</p>
<h2 id="LookupPort">func <a href="http://localhost:6060/src/net/lookup.go?s=3492:3554#L115">LookupPort</a></h2>
<pre>func LookupPort(network, service <a href="../builtin/index.html#string">string</a>) (port <a href="../builtin/index.html#int">int</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
LookupPort looks up the port for the given network and service.
</p>
<h2 id="LookupSRV">func <a href="http://localhost:6060/src/net/lookup.go?s=4778:4861#L151">LookupSRV</a></h2>
<pre>func LookupSRV(service, proto, name <a href="../builtin/index.html#string">string</a>) (cname <a href="../builtin/index.html#string">string</a>, addrs []*<a href="index.html#SRV">SRV</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
LookupSRV tries to resolve an SRV query of the given service,
protocol, and domain name. The proto is &#34;tcp&#34; or &#34;udp&#34;.
The returned records are sorted by priority and randomized
by weight within a priority.
</p>
<p>
LookupSRV constructs the DNS name to look up following RFC 2782.
That is, it looks up _service._proto.name. To accommodate services
publishing SRV records under non-standard names, if both service
and proto are empty strings, LookupSRV looks up name directly.
</p>
<h2 id="LookupTXT">func <a href="http://localhost:6060/src/net/lookup.go?s=5284:5338#L166">LookupTXT</a></h2>
<pre>func LookupTXT(name <a href="../builtin/index.html#string">string</a>) (txts []<a href="../builtin/index.html#string">string</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
LookupTXT returns the DNS TXT records for the given domain name.
</p>
<h2 id="SplitHostPort">func <a href="http://localhost:6060/src/net/ipsock.go?s=3366:3432#L102">SplitHostPort</a></h2>
<pre>func SplitHostPort(hostport <a href="../builtin/index.html#string">string</a>) (host, port <a href="../builtin/index.html#string">string</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
SplitHostPort splits a network address of the form &#34;host:port&#34;,
&#34;[host]:port&#34; or &#34;[ipv6-host%zone]:port&#34; into host or
ipv6-host%zone and port. A literal address or host name for IPv6
must be enclosed in square brackets, as in &#34;[::1]:80&#34;,
&#34;[ipv6-host]:http&#34; or &#34;[ipv6-host%zone]:80&#34;.
</p>
<h2 id="Addr">type <a href="http://localhost:6060/src/net/net.go?s=3567:3675#L94">Addr</a></h2>
<pre>type Addr interface {
Network() <a href="../builtin/index.html#string">string</a> <span class="comment">// name of the network</span>
String() <a href="../builtin/index.html#string">string</a> <span class="comment">// string form of address</span>
}</pre>
<p>
Addr represents a network end point address.
</p>
<h2 id="AddrError">type <a href="http://localhost:6060/src/net/net.go?s=14757:14808#L474">AddrError</a></h2>
<pre>type AddrError struct {
Err <a href="../builtin/index.html#string">string</a>
Addr <a href="../builtin/index.html#string">string</a>
}</pre>
<h3 id="AddrError.Error">func (*AddrError) <a href="http://localhost:6060/src/net/net.go?s=14810:14844#L479">Error</a></h3>
<pre>func (e *<a href="index.html#AddrError">AddrError</a>) Error() <a href="../builtin/index.html#string">string</a></pre>
<h3 id="AddrError.Temporary">func (*AddrError) <a href="http://localhost:6060/src/net/net.go?s=15003:15039#L491">Temporary</a></h3>
<pre>func (e *<a href="index.html#AddrError">AddrError</a>) Temporary() <a href="../builtin/index.html#bool">bool</a></pre>
<h3 id="AddrError.Timeout">func (*AddrError) <a href="http://localhost:6060/src/net/net.go?s=14949:14983#L490">Timeout</a></h3>
<pre>func (e *<a href="index.html#AddrError">AddrError</a>) Timeout() <a href="../builtin/index.html#bool">bool</a></pre>
<h2 id="Conn">type <a href="http://localhost:6060/src/net/net.go?s=3805:5570#L102">Conn</a></h2>
<pre>type Conn interface {
<span class="comment">// Read reads data from the connection.</span>
<span class="comment">// Read can be made to time out and return a Error with Timeout() == true</span>
<span class="comment">// after a fixed time limit; see SetDeadline and SetReadDeadline.</span>
Read(b []<a href="../builtin/index.html#byte">byte</a>) (n <a href="../builtin/index.html#int">int</a>, err <a href="../builtin/index.html#error">error</a>)
<span class="comment">// Write writes data to the connection.</span>
<span class="comment">// Write can be made to time out and return a Error with Timeout() == true</span>
<span class="comment">// after a fixed time limit; see SetDeadline and SetWriteDeadline.</span>
Write(b []<a href="../builtin/index.html#byte">byte</a>) (n <a href="../builtin/index.html#int">int</a>, err <a href="../builtin/index.html#error">error</a>)
<span class="comment">// Close closes the connection.</span>
<span class="comment">// Any blocked Read or Write operations will be unblocked and return errors.</span>
Close() <a href="../builtin/index.html#error">error</a>
<span class="comment">// LocalAddr returns the local network address.</span>
LocalAddr() <a href="index.html#Addr">Addr</a>
<span class="comment">// RemoteAddr returns the remote network address.</span>
RemoteAddr() <a href="index.html#Addr">Addr</a>
<span class="comment">// SetDeadline sets the read and write deadlines associated</span>
<span class="comment">// with the connection. It is equivalent to calling both</span>
<span class="comment">// SetReadDeadline and SetWriteDeadline.</span>
<span class="comment">//</span>
<span class="comment">// A deadline is an absolute time after which I/O operations</span>
<span class="comment">// fail with a timeout (see type Error) instead of</span>
<span class="comment">// blocking. The deadline applies to all future I/O, not just</span>
<span class="comment">// the immediately following call to Read or Write.</span>
<span class="comment">//</span>
<span class="comment">// An idle timeout can be implemented by repeatedly extending</span>
<span class="comment">// the deadline after successful Read or Write calls.</span>
<span class="comment">//</span>
<span class="comment">// A zero value for t means I/O operations will not time out.</span>
SetDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a>
<span class="comment">// SetReadDeadline sets the deadline for future Read calls.</span>
<span class="comment">// A zero value for t means Read will not time out.</span>
SetReadDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a>
<span class="comment">// SetWriteDeadline sets the deadline for future Write calls.</span>
<span class="comment">// Even if write times out, it may return n &gt; 0, indicating that</span>
<span class="comment">// some of the data was successfully written.</span>
<span class="comment">// A zero value for t means Write will not time out.</span>
SetWriteDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a>
}</pre>
<p>
Conn is a generic stream-oriented network connection.
</p>
<p>
Multiple goroutines may invoke methods on a Conn simultaneously.
</p>
<h3 id="Dial">func <a href="http://localhost:6060/src/net/dial.go?s=5682:5730#L181">Dial</a></h3>
<pre>func Dial(network, address <a href="../builtin/index.html#string">string</a>) (<a href="index.html#Conn">Conn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Dial connects to the address on the named network.
</p>
<p>
Known networks are &#34;tcp&#34;, &#34;tcp4&#34; (IPv4-only), &#34;tcp6&#34; (IPv6-only),
&#34;udp&#34;, &#34;udp4&#34; (IPv4-only), &#34;udp6&#34; (IPv6-only), &#34;ip&#34;, &#34;ip4&#34;
(IPv4-only), &#34;ip6&#34; (IPv6-only), &#34;unix&#34;, &#34;unixgram&#34; and
&#34;unixpacket&#34;.
</p>
<p>
For TCP and UDP networks, addresses have the form host:port.
If host is a literal IPv6 address it must be enclosed
in square brackets as in &#34;[::1]:80&#34; or &#34;[ipv6-host%zone]:80&#34;.
The functions JoinHostPort and SplitHostPort manipulate addresses
in this form.
If the host is empty, as in &#34;:80&#34;, the local system is assumed.
</p>
<p>
Examples:
</p>
<pre>Dial(&#34;tcp&#34;, &#34;12.34.56.78:80&#34;)
Dial(&#34;tcp&#34;, &#34;google.com:http&#34;)
Dial(&#34;tcp&#34;, &#34;[2001:db8::1]:http&#34;)
Dial(&#34;tcp&#34;, &#34;[fe80::1%lo0]:80&#34;)
Dial(&#34;tcp&#34;, &#34;:80&#34;)
</pre>
<p>
For IP networks, the network must be &#34;ip&#34;, &#34;ip4&#34; or &#34;ip6&#34; followed
by a colon and a protocol number or name and the addr must be a
literal IP address.
</p>
<p>
Examples:
</p>
<pre>Dial(&#34;ip4:1&#34;, &#34;127.0.0.1&#34;)
Dial(&#34;ip6:ospf&#34;, &#34;::1&#34;)
</pre>
<p>
For Unix networks, the address must be a file system path.
</p>
<h3 id="DialTimeout">func <a href="http://localhost:6060/src/net/dial.go?s=5888:5966#L188">DialTimeout</a></h3>
<pre>func DialTimeout(network, address <a href="../builtin/index.html#string">string</a>, timeout <a href="../time/index.html">time</a>.<a href="../time/index.html#Duration">Duration</a>) (<a href="index.html#Conn">Conn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
DialTimeout acts like Dial but takes a timeout.
The timeout includes name resolution, if required.
</p>
<h3 id="FileConn">func <a href="http://localhost:6060/src/net/file.go?s=538:583#L8">FileConn</a></h3>
<pre>func FileConn(f *<a href="../os/index.html">os</a>.<a href="../os/index.html#File">File</a>) (c <a href="index.html#Conn">Conn</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
FileConn returns a copy of the network connection corresponding to
the open file f.
It is the caller&#39;s responsibility to close f when finished.
Closing c does not affect f, and closing f does not affect c.
</p>
<h3 id="Pipe">func <a href="http://localhost:6060/src/net/pipe.go?s=462:486#L8">Pipe</a></h3>
<pre>func Pipe() (<a href="index.html#Conn">Conn</a>, <a href="index.html#Conn">Conn</a>)</pre>
<p>
Pipe creates a synchronous, in-memory, full duplex
network connection; both ends implement the Conn interface.
Reads on one end are matched with writes on the other,
copying data directly between the two; there is no internal
buffering.
</p>
<h2 id="DNSConfigError">type <a href="http://localhost:6060/src/net/net.go?s=15645:15686#L507">DNSConfigError</a></h2>
<pre>type DNSConfigError struct {
Err <a href="../builtin/index.html#error">error</a>
}</pre>
<p>
DNSConfigError represents an error reading the machine&#39;s DNS configuration.
(No longer used; kept for compatibility.)
</p>
<h3 id="DNSConfigError.Error">func (*DNSConfigError) <a href="http://localhost:6060/src/net/net.go?s=15688:15727#L511">Error</a></h3>
<pre>func (e *<a href="index.html#DNSConfigError">DNSConfigError</a>) Error() <a href="../builtin/index.html#string">string</a></pre>
<h3 id="DNSConfigError.Temporary">func (*DNSConfigError) <a href="http://localhost:6060/src/net/net.go?s=15845:15886#L513">Temporary</a></h3>
<pre>func (e *<a href="index.html#DNSConfigError">DNSConfigError</a>) Temporary() <a href="../builtin/index.html#bool">bool</a></pre>
<h3 id="DNSConfigError.Timeout">func (*DNSConfigError) <a href="http://localhost:6060/src/net/net.go?s=15786:15825#L512">Timeout</a></h3>
<pre>func (e *<a href="index.html#DNSConfigError">DNSConfigError</a>) Timeout() <a href="../builtin/index.html#bool">bool</a></pre>
<h2 id="DNSError">type <a href="http://localhost:6060/src/net/net.go?s=16042:16333#L521">DNSError</a></h2>
<pre>type DNSError struct {
Err <a href="../builtin/index.html#string">string</a> <span class="comment">// description of the error</span>
Name <a href="../builtin/index.html#string">string</a> <span class="comment">// name looked for</span>
Server <a href="../builtin/index.html#string">string</a> <span class="comment">// server used</span>
IsTimeout <a href="../builtin/index.html#bool">bool</a> <span class="comment">// if true, timed out; not all timeouts set this</span>
IsTemporary <a href="../builtin/index.html#bool">bool</a> <span class="comment">// if true, error is temporary; not all errors set this</span>
}</pre>
<p>
DNSError represents a DNS lookup error.
</p>
<h3 id="DNSError.Error">func (*DNSError) <a href="http://localhost:6060/src/net/net.go?s=16335:16368#L529">Error</a></h3>
<pre>func (e *<a href="index.html#DNSError">DNSError</a>) Error() <a href="../builtin/index.html#string">string</a></pre>
<h3 id="DNSError.Temporary">func (*DNSError) <a href="http://localhost:6060/src/net/net.go?s=16971:17006#L549">Temporary</a></h3>
<pre>func (e *<a href="index.html#DNSError">DNSError</a>) Temporary() <a href="../builtin/index.html#bool">bool</a></pre>
<p>
Temporary reports whether the DNS error is known to be temporary.
This is not always known; a DNS lookup may fail due to a temporary
error and return a DNSError for which Temporary returns false.
</p>
<h3 id="DNSError.Timeout">func (*DNSError) <a href="http://localhost:6060/src/net/net.go?s=16708:16741#L544">Timeout</a></h3>
<pre>func (e *<a href="index.html#DNSError">DNSError</a>) Timeout() <a href="../builtin/index.html#bool">bool</a></pre>
<p>
Timeout reports whether the DNS lookup is known to have timed out.
This is not always known; a DNS lookup may fail due to a timeout
and return a DNSError for which Timeout returns false.
</p>
<h2 id="Dialer">type <a href="http://localhost:6060/src/net/dial.go?s=448:2248#L7">Dialer</a></h2>
<pre>type Dialer struct {
<span class="comment">// Timeout is the maximum amount of time a dial will wait for</span>
<span class="comment">// a connect to complete. If Deadline is also set, it may fail</span>
<span class="comment">// earlier.</span>
<span class="comment">//</span>
<span class="comment">// The default is no timeout.</span>
<span class="comment">//</span>
<span class="comment">// When dialing a name with multiple IP addresses, the timeout</span>
<span class="comment">// may be divided between them.</span>
<span class="comment">//</span>
<span class="comment">// With or without a timeout, the operating system may impose</span>
<span class="comment">// its own earlier timeout. For instance, TCP timeouts are</span>
<span class="comment">// often around 3 minutes.</span>
Timeout <a href="../time/index.html">time</a>.<a href="../time/index.html#Duration">Duration</a>
<span class="comment">// Deadline is the absolute point in time after which dials</span>
<span class="comment">// will fail. If Timeout is set, it may fail earlier.</span>
<span class="comment">// Zero means no deadline, or dependent on the operating system</span>
<span class="comment">// as with the Timeout option.</span>
Deadline <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>
<span class="comment">// LocalAddr is the local address to use when dialing an</span>
<span class="comment">// address. The address must be of a compatible type for the</span>
<span class="comment">// network being dialed.</span>
<span class="comment">// If nil, a local address is automatically chosen.</span>
LocalAddr <a href="index.html#Addr">Addr</a>
<span class="comment">// DualStack enables RFC 6555-compliant &#34;Happy Eyeballs&#34; dialing</span>
<span class="comment">// when the network is &#34;tcp&#34; and the destination is a host name</span>
<span class="comment">// with both IPv4 and IPv6 addresses. This allows a client to</span>
<span class="comment">// tolerate networks where one address family is silently broken.</span>
DualStack <a href="../builtin/index.html#bool">bool</a>
<span class="comment">// FallbackDelay specifies the length of time to wait before</span>
<span class="comment">// spawning a fallback connection, when DualStack is enabled.</span>
<span class="comment">// If zero, a default delay of 300ms is used.</span>
FallbackDelay <a href="../time/index.html">time</a>.<a href="../time/index.html#Duration">Duration</a>
<span class="comment">// KeepAlive specifies the keep-alive period for an active</span>
<span class="comment">// network connection.</span>
<span class="comment">// If zero, keep-alives are not enabled. Network protocols</span>
<span class="comment">// that do not support keep-alives ignore this field.</span>
KeepAlive <a href="../time/index.html">time</a>.<a href="../time/index.html#Duration">Duration</a>
<span class="comment">// Cancel is an optional channel whose closure indicates that</span>
<span class="comment">// the dial should be canceled. Not all types of dials support</span>
<span class="comment">// cancelation.</span>
Cancel &lt;-chan struct{}
}</pre>
<p>
A Dialer contains options for connecting to an address.
</p>
<p>
The zero value for each field is equivalent to dialing
without that option. Dialing with the zero value of Dialer
is therefore equivalent to just calling the Dial function.
</p>
<h3 id="Dialer.Dial">func (*Dialer) <a href="http://localhost:6060/src/net/dial.go?s=6319:6379#L204">Dial</a></h3>
<pre>func (d *<a href="index.html#Dialer">Dialer</a>) Dial(network, address <a href="../builtin/index.html#string">string</a>) (<a href="index.html#Conn">Conn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Dial connects to the address on the named network.
</p>
<p>
See func Dial for a description of the network and address
parameters.
</p>
<h2 id="Error">type <a href="http://localhost:6060/src/net/net.go?s=11560:11681#L349">Error</a></h2>
<pre>type Error interface {
<a href="../builtin/index.html#error">error</a>
Timeout() <a href="../builtin/index.html#bool">bool</a> <span class="comment">// Is the error a timeout?</span>
Temporary() <a href="../builtin/index.html#bool">bool</a> <span class="comment">// Is the error temporary?</span>
}</pre>
<p>
An Error represents a network error.
</p>
<h2 id="Flags">type <a href="http://localhost:6060/src/net/interface.go?s=1086:1101#L18">Flags</a></h2>
<pre>type Flags <a href="../builtin/index.html#uint">uint</a></pre>
<pre>const (
<span id="FlagUp">FlagUp</span> <a href="index.html#Flags">Flags</a> = 1 &lt;&lt; <a href="../builtin/index.html#iota">iota</a> <span class="comment">// interface is up</span>
<span id="FlagBroadcast">FlagBroadcast</span> <span class="comment">// interface supports broadcast access capability</span>
<span id="FlagLoopback">FlagLoopback</span> <span class="comment">// interface is a loopback interface</span>
<span id="FlagPointToPoint">FlagPointToPoint</span> <span class="comment">// interface belongs to a point-to-point link</span>
<span id="FlagMulticast">FlagMulticast</span> <span class="comment">// interface supports multicast access capability</span>
)</pre>
<h3 id="Flags.String">func (Flags) <a href="http://localhost:6060/src/net/interface.go?s=1590:1620#L36">String</a></h3>
<pre>func (f <a href="index.html#Flags">Flags</a>) String() <a href="../builtin/index.html#string">string</a></pre>
<h2 id="HardwareAddr">type <a href="http://localhost:6060/src/net/mac.go?s=269:293#L1">HardwareAddr</a></h2>
<pre>type HardwareAddr []<a href="../builtin/index.html#byte">byte</a></pre>
<p>
A HardwareAddr represents a physical hardware address.
</p>
<h3 id="ParseMAC">func <a href="http://localhost:6060/src/net/mac.go?s=1054:1106#L28">ParseMAC</a></h3>
<pre>func ParseMAC(s <a href="../builtin/index.html#string">string</a>) (hw <a href="index.html#HardwareAddr">HardwareAddr</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ParseMAC parses s as an IEEE 802 MAC-48, EUI-48, EUI-64, or a 20-octet
IP over InfiniBand link-layer address using one of the following formats:
</p>
<pre>01:23:45:67:89:ab
01:23:45:67:89:ab:cd:ef
01:23:45:67:89:ab:cd:ef:00:00:01:23:45:67:89:ab:cd:ef:00:00
01-23-45-67-89-ab
01-23-45-67-89-ab-cd-ef
01-23-45-67-89-ab-cd-ef-00-00-01-23-45-67-89-ab-cd-ef-00-00
0123.4567.89ab
0123.4567.89ab.cdef
0123.4567.89ab.cdef.0000.0123.4567.89ab.cdef.0000
</pre>
<h3 id="HardwareAddr.String">func (HardwareAddr) <a href="http://localhost:6060/src/net/mac.go?s=295:332#L2">String</a></h3>
<pre>func (a <a href="index.html#HardwareAddr">HardwareAddr</a>) String() <a href="../builtin/index.html#string">string</a></pre>
<h2 id="IP">type <a href="http://localhost:6060/src/net/ip.go?s=919:933#L20">IP</a></h2>
<pre>type IP []<a href="../builtin/index.html#byte">byte</a></pre>
<p>
An IP is a single IP address, a slice of bytes.
Functions in this package accept either 4-byte (IPv4)
or 16-byte (IPv6) slices as input.
</p>
<p>
Note that in this documentation, referring to an
IP address as an IPv4 address or an IPv6 address
is a semantic property of the address, not just the
length of the byte slice: a 16-byte slice can still
be an IPv4 address.
</p>
<h3 id="IPv4">func <a href="http://localhost:6060/src/net/ip.go?s=1189:1218#L33">IPv4</a></h3>
<pre>func IPv4(a, b, c, d <a href="../builtin/index.html#byte">byte</a>) <a href="index.html#IP">IP</a></pre>
<p>
IPv4 returns the IP address (in 16-byte form) of the
IPv4 address a.b.c.d.
</p>
<h3 id="ParseCIDR">func <a href="http://localhost:6060/src/net/ip.go?s=14922:14966#L648">ParseCIDR</a></h3>
<pre>func ParseCIDR(s <a href="../builtin/index.html#string">string</a>) (<a href="index.html#IP">IP</a>, *<a href="index.html#IPNet">IPNet</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ParseCIDR parses s as a CIDR notation IP address and mask,
like &#34;192.168.100.1/24&#34; or &#34;2001:DB8::/48&#34;, as defined in
RFC 4632 and RFC 4291.
</p>
<p>
It returns the IP address and the network implied by the IP
and mask. For example, ParseCIDR(&#34;192.168.100.1/16&#34;) returns
the IP address 192.168.100.1 and the network 192.168.0.0/16.
</p>
<h3 id="ParseIP">func <a href="http://localhost:6060/src/net/ip.go?s=14389:14414#L628">ParseIP</a></h3>
<pre>func ParseIP(s <a href="../builtin/index.html#string">string</a>) <a href="index.html#IP">IP</a></pre>
<p>
ParseIP parses s as an IP address, returning the result.
The string s can be in dotted decimal (&#34;74.125.19.99&#34;)
or IPv6 (&#34;2001:4860:0:2001::68&#34;) form.
If s is not a valid textual representation of an IP address,
ParseIP returns nil.
</p>
<h3 id="IP.DefaultMask">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=5567:5600#L202">DefaultMask</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) DefaultMask() <a href="index.html#IPMask">IPMask</a></pre>
<p>
DefaultMask returns the default IP mask for the IP address ip.
Only IPv4 addresses have default masks; DefaultMask returns
nil if ip is not a valid IPv4 address.
</p>
<h3 id="IP.Equal">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=8648:8677#L345">Equal</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) Equal(x <a href="index.html#IP">IP</a>) <a href="../builtin/index.html#bool">bool</a></pre>
<p>
Equal reports whether ip and x are the same IP address.
An IPv4 address and that same address in IPv6 form are
considered to be equal.
</p>
<h3 id="IP.IsGlobalUnicast">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=4290:4325#L146">IsGlobalUnicast</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) IsGlobalUnicast() <a href="../builtin/index.html#bool">bool</a></pre>
<p>
IsGlobalUnicast reports whether ip is a global unicast
address.
</p>
<h3 id="IP.IsInterfaceLocalMulticast">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=3556:3601#L122">IsInterfaceLocalMulticast</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) IsInterfaceLocalMulticast() <a href="../builtin/index.html#bool">bool</a></pre>
<p>
IsInterfaceLocalMulticast reports whether ip is
an interface-local multicast address.
</p>
<h3 id="IP.IsLinkLocalMulticast">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=3754:3794#L128">IsLinkLocalMulticast</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) IsLinkLocalMulticast() <a href="../builtin/index.html#bool">bool</a></pre>
<p>
IsLinkLocalMulticast reports whether ip is a link-local
multicast address.
</p>
<h3 id="IP.IsLinkLocalUnicast">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=4033:4071#L137">IsLinkLocalUnicast</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) IsLinkLocalUnicast() <a href="../builtin/index.html#bool">bool</a></pre>
<p>
IsLinkLocalUnicast reports whether ip is a link-local
unicast address.
</p>
<h3 id="IP.IsLoopback">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=3132:3162#L105">IsLoopback</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) IsLoopback() <a href="../builtin/index.html#bool">bool</a></pre>
<p>
IsLoopback reports whether ip is a loopback address.
</p>
<h3 id="IP.IsMulticast">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=3317:3348#L113">IsMulticast</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) IsMulticast() <a href="../builtin/index.html#bool">bool</a></pre>
<p>
IsMulticast reports whether ip is a multicast address.
</p>
<h3 id="IP.IsUnspecified">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=2981:3014#L100">IsUnspecified</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) IsUnspecified() <a href="../builtin/index.html#bool">bool</a></pre>
<p>
IsUnspecified reports whether ip is an unspecified address.
</p>
<h3 id="IP.MarshalText">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=7900:7942#L316">MarshalText</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) MarshalText() ([]<a href="../builtin/index.html#byte">byte</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
MarshalText implements the encoding.TextMarshaler interface.
The encoding is the same as returned by String.
</p>
<h3 id="IP.Mask">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=5955:5988#L226">Mask</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) Mask(mask <a href="index.html#IPMask">IPMask</a>) <a href="index.html#IP">IP</a></pre>
<p>
Mask returns the result of masking the IP address ip with mask.
</p>
<h3 id="IP.String">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=6554:6582#L248">String</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) String() <a href="../builtin/index.html#string">string</a></pre>
<p>
String returns the string form of the IP address ip.
If the address is an IPv4 address, the string representation
is dotted decimal (&#34;74.125.19.99&#34;). Otherwise the representation
is IPv6 (&#34;2001:4860:0:2001::68&#34;).
</p>
<h3 id="IP.To16">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=5081:5103#L182">To16</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) To16() <a href="index.html#IP">IP</a></pre>
<p>
To16 converts the IP address ip to a 16-byte representation.
If ip is not an IP address (it is the wrong length), To16 returns nil.
</p>
<h3 id="IP.To4">func (IP) <a href="http://localhost:6060/src/net/ip.go?s=4754:4775#L167">To4</a></h3>
<pre>func (ip <a href="index.html#IP">IP</a>) To4() <a href="index.html#IP">IP</a></pre>
<p>
To4 converts the IPv4 address ip to a 4-byte representation.
If ip is not an IPv4 address, To4 returns nil.
</p>
<h3 id="IP.UnmarshalText">func (*IP) <a href="http://localhost:6060/src/net/ip.go?s=8278:8324#L328">UnmarshalText</a></h3>
<pre>func (ip *<a href="index.html#IP">IP</a>) UnmarshalText(text []<a href="../builtin/index.html#byte">byte</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
UnmarshalText implements the encoding.TextUnmarshaler interface.
The IP address is expected in a form accepted by ParseIP.
</p>
<h2 id="IPAddr">type <a href="http://localhost:6060/src/net/iprawsock.go?s=227:302#L1">IPAddr</a></h2>
<pre>type IPAddr struct {
IP <a href="index.html#IP">IP</a>
Zone <a href="../builtin/index.html#string">string</a> <span class="comment">// IPv6 scoped addressing zone</span>
}</pre>
<p>
IPAddr represents the address of an IP end point.
</p>
<h3 id="ResolveIPAddr">func <a href="http://localhost:6060/src/net/iprawsock.go?s=937:990#L34">ResolveIPAddr</a></h3>
<pre>func ResolveIPAddr(net, addr <a href="../builtin/index.html#string">string</a>) (*<a href="index.html#IPAddr">IPAddr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ResolveIPAddr parses addr as an IP address of the form &#34;host&#34; or
&#34;ipv6-host%zone&#34; and resolves the domain name on the network net,
which must be &#34;ip&#34;, &#34;ip4&#34; or &#34;ip6&#34;.
</p>
<h3 id="IPAddr.Network">func (*IPAddr) <a href="http://localhost:6060/src/net/iprawsock.go?s=357:390#L4">Network</a></h3>
<pre>func (a *<a href="index.html#IPAddr">IPAddr</a>) Network() <a href="../builtin/index.html#string">string</a></pre>
<p>
Network returns the address&#39;s network name, &#34;ip&#34;.
</p>
<h3 id="IPAddr.String">func (*IPAddr) <a href="http://localhost:6060/src/net/iprawsock.go?s=408:440#L6">String</a></h3>
<pre>func (a *<a href="index.html#IPAddr">IPAddr</a>) String() <a href="../builtin/index.html#string">string</a></pre>
<h2 id="IPConn">type <a href="http://localhost:6060/src/net/iprawsock_posix.go?s=1537:1565#L45">IPConn</a></h2>
<pre>type IPConn struct {
<span class="comment">// contains filtered or unexported fields</span>
}</pre>
<p>
IPConn is the implementation of the Conn and PacketConn interfaces
for IP network connections.
</p>
<h3 id="DialIP">func <a href="http://localhost:6060/src/net/iprawsock_posix.go?s=6293:6360#L196">DialIP</a></h3>
<pre>func DialIP(netProto <a href="../builtin/index.html#string">string</a>, laddr, raddr *<a href="index.html#IPAddr">IPAddr</a>) (*<a href="index.html#IPConn">IPConn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
DialIP connects to the remote address raddr on the network protocol
netProto, which must be &#34;ip&#34;, &#34;ip4&#34;, or &#34;ip6&#34; followed by a colon
and a protocol number or name.
</p>
<h3 id="ListenIP">func <a href="http://localhost:6060/src/net/iprawsock_posix.go?s=7465:7527#L224">ListenIP</a></h3>
<pre>func ListenIP(netProto <a href="../builtin/index.html#string">string</a>, laddr *<a href="index.html#IPAddr">IPAddr</a>) (*<a href="index.html#IPConn">IPConn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ListenIP listens for incoming IP packets addressed to the local
address laddr. The returned connection&#39;s ReadFrom and WriteTo
methods can be used to receive and send IP packets with per-packet
addressing.
</p>
<h3 id="IPConn.Close">func (*IPConn) <a href="http://localhost:6060/src/net/net.go?s=6330:6358#L182">Close</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) Close() <a href="../builtin/index.html#error">error</a></pre>
<p>
Close closes the connection.
</p>
<h3 id="IPConn.File">func (*IPConn) <a href="http://localhost:6060/src/net/net.go?s=9014:9059#L277">File</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) File() (f *<a href="../os/index.html">os</a>.<a href="../os/index.html#File">File</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
File sets the underlying os.File to blocking mode and returns a copy.
It is the caller&#39;s responsibility to close f when finished.
Closing c does not affect f, and closing f does not affect c.
</p>
<p>
The returned os.File&#39;s file descriptor is different from the connection&#39;s.
Attempting to change properties of the original using this duplicate
may or may not have the desired effect.
</p>
<h3 id="IPConn.LocalAddr">func (*IPConn) <a href="http://localhost:6060/src/net/net.go?s=6687:6718#L196">LocalAddr</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) LocalAddr() <a href="index.html#Addr">Addr</a></pre>
<p>
LocalAddr returns the local network address.
The Addr returned is shared by all invocations of LocalAddr, so
do not modify it.
</p>
<h3 id="IPConn.Read">func (*IPConn) <a href="http://localhost:6060/src/net/net.go?s=5749:5791#L158">Read</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) Read(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Read implements the Conn Read method.
</p>
<h3 id="IPConn.ReadFrom">func (*IPConn) <a href="http://localhost:6060/src/net/iprawsock_posix.go?s=2833:2887#L95">ReadFrom</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) ReadFrom(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, <a href="index.html#Addr">Addr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ReadFrom implements the PacketConn ReadFrom method.
</p>
<h3 id="IPConn.ReadFromIP">func (*IPConn) <a href="http://localhost:6060/src/net/iprawsock_posix.go?s=1951:2010#L58">ReadFromIP</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) ReadFromIP(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, *<a href="index.html#IPAddr">IPAddr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ReadFromIP reads an IP packet from c, copying the payload into b.
It returns the number of bytes copied into b and the return address
that was on the packet.
</p>
<p>
ReadFromIP can be made to time out and return an error with
Timeout() == true after a fixed time limit; see SetDeadline and
SetReadDeadline.
</p>
<h3 id="IPConn.ReadMsgIP">func (*IPConn) <a href="http://localhost:6060/src/net/iprawsock_posix.go?s=3316:3403#L110">ReadMsgIP</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) ReadMsgIP(b, oob []<a href="../builtin/index.html#byte">byte</a>) (n, oobn, flags <a href="../builtin/index.html#int">int</a>, addr *<a href="index.html#IPAddr">IPAddr</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ReadMsgIP reads a packet from c, copying the payload into b and the
associated out-of-band data into oob. It returns the number of
bytes copied into b, the number of bytes copied into oob, the flags
that were set on the packet and the source address of the packet.
</p>
<h3 id="IPConn.RemoteAddr">func (*IPConn) <a href="http://localhost:6060/src/net/net.go?s=6912:6944#L206">RemoteAddr</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) RemoteAddr() <a href="index.html#Addr">Addr</a></pre>
<p>
RemoteAddr returns the remote network address.
The Addr returned is shared by all invocations of RemoteAddr, so
do not modify it.
</p>
<h3 id="IPConn.SetDeadline">func (*IPConn) <a href="http://localhost:6060/src/net/net.go?s=7054:7099#L214">SetDeadline</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) SetDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetDeadline implements the Conn SetDeadline method.
</p>
<h3 id="IPConn.SetReadBuffer">func (*IPConn) <a href="http://localhost:6060/src/net/net.go?s=8018:8063#L248">SetReadBuffer</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) SetReadBuffer(bytes <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetReadBuffer sets the size of the operating system&#39;s
receive buffer associated with the connection.
</p>
<h3 id="IPConn.SetReadDeadline">func (*IPConn) <a href="http://localhost:6060/src/net/net.go?s=7354:7403#L225">SetReadDeadline</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) SetReadDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetReadDeadline implements the Conn SetReadDeadline method.
</p>
<h3 id="IPConn.SetWriteBuffer">func (*IPConn) <a href="http://localhost:6060/src/net/net.go?s=8371:8417#L260">SetWriteBuffer</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) SetWriteBuffer(bytes <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetWriteBuffer sets the size of the operating system&#39;s
transmit buffer associated with the connection.
</p>
<h3 id="IPConn.SetWriteDeadline">func (*IPConn) <a href="http://localhost:6060/src/net/net.go?s=7664:7714#L236">SetWriteDeadline</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) SetWriteDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetWriteDeadline implements the Conn SetWriteDeadline method.
</p>
<h3 id="IPConn.Write">func (*IPConn) <a href="http://localhost:6060/src/net/net.go?s=6052:6095#L170">Write</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) Write(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Write implements the Conn Write method.
</p>
<h3 id="IPConn.WriteMsgIP">func (*IPConn) <a href="http://localhost:6060/src/net/iprawsock_posix.go?s=5360:5441#L171">WriteMsgIP</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) WriteMsgIP(b, oob []<a href="../builtin/index.html#byte">byte</a>, addr *<a href="index.html#IPAddr">IPAddr</a>) (n, oobn <a href="../builtin/index.html#int">int</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
WriteMsgIP writes a packet to addr via c, copying the payload from
b and the associated out-of-band data from oob. It returns the
number of payload and out-of-band bytes written.
</p>
<h3 id="IPConn.WriteTo">func (*IPConn) <a href="http://localhost:6060/src/net/iprawsock_posix.go?s=4897:4955#L157">WriteTo</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) WriteTo(b []<a href="../builtin/index.html#byte">byte</a>, addr <a href="index.html#Addr">Addr</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
WriteTo implements the PacketConn WriteTo method.
</p>
<h3 id="IPConn.WriteToIP">func (*IPConn) <a href="http://localhost:6060/src/net/iprawsock_posix.go?s=4143:4206#L135">WriteToIP</a></h3>
<pre>func (c *<a href="index.html#IPConn">IPConn</a>) WriteToIP(b []<a href="../builtin/index.html#byte">byte</a>, addr *<a href="index.html#IPAddr">IPAddr</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
WriteToIP writes an IP packet to addr via c, copying the payload
from b.
</p>
<p>
WriteToIP can be made to time out and return an error with
Timeout() == true after a fixed time limit; see SetDeadline and
SetWriteDeadline. On packet-oriented connections, write timeouts
are rare.
</p>
<h2 id="IPMask">type <a href="http://localhost:6060/src/net/ip.go?s=967:985#L23">IPMask</a></h2>
<pre>type IPMask []<a href="../builtin/index.html#byte">byte</a></pre>
<p>
An IP mask is an IP address.
</p>
<h3 id="CIDRMask">func <a href="http://localhost:6060/src/net/ip.go?s=1774:1810#L59">CIDRMask</a></h3>
<pre>func CIDRMask(ones, bits <a href="../builtin/index.html#int">int</a>) <a href="index.html#IPMask">IPMask</a></pre>
<p>
CIDRMask returns an IPMask consisting of `ones&#39; 1 bits
followed by 0s up to a total length of `bits&#39; bits.
For a mask of this form, CIDRMask is the inverse of IPMask.Size.
</p>
<h3 id="IPv4Mask">func <a href="http://localhost:6060/src/net/ip.go?s=1472:1509#L47">IPv4Mask</a></h3>
<pre>func IPv4Mask(a, b, c, d <a href="../builtin/index.html#byte">byte</a>) <a href="index.html#IPMask">IPMask</a></pre>
<p>
IPv4Mask returns the IP mask (in 4-byte form) of the
IPv4 mask a.b.c.d.
</p>
<h3 id="IPMask.Size">func (IPMask) <a href="http://localhost:6060/src/net/ip.go?s=9758:9797#L402">Size</a></h3>
<pre>func (m <a href="index.html#IPMask">IPMask</a>) Size() (ones, bits <a href="../builtin/index.html#int">int</a>)</pre>
<p>
Size returns the number of leading ones and total bits in the mask.
If the mask is not in the canonical form--ones followed by zeros--then
Size returns 0, 0.
</p>
<h3 id="IPMask.String">func (IPMask) <a href="http://localhost:6060/src/net/ip.go?s=9955:9986#L411">String</a></h3>
<pre>func (m <a href="index.html#IPMask">IPMask</a>) String() <a href="../builtin/index.html#string">string</a></pre>
<p>
String returns the hexadecimal form of m, with no punctuation.
</p>
<h2 id="IPNet">type <a href="http://localhost:6060/src/net/ip.go?s=1025:1106#L26">IPNet</a></h2>
<pre>type IPNet struct {
IP <a href="index.html#IP">IP</a> <span class="comment">// network number</span>
Mask <a href="index.html#IPMask">IPMask</a> <span class="comment">// network mask</span>
}</pre>
<p>
An IPNet represents an IP network.
</p>
<h3 id="IPNet.Contains">func (*IPNet) <a href="http://localhost:6060/src/net/ip.go?s=10564:10600#L446">Contains</a></h3>
<pre>func (n *<a href="index.html#IPNet">IPNet</a>) Contains(ip <a href="index.html#IP">IP</a>) <a href="../builtin/index.html#bool">bool</a></pre>
<p>
Contains reports whether the network includes ip.
</p>
<h3 id="IPNet.Network">func (*IPNet) <a href="http://localhost:6060/src/net/ip.go?s=10884:10916#L464">Network</a></h3>
<pre>func (n *<a href="index.html#IPNet">IPNet</a>) Network() <a href="../builtin/index.html#string">string</a></pre>
<p>
Network returns the address&#39;s network name, &#34;ip+net&#34;.
</p>
<h3 id="IPNet.String">func (*IPNet) <a href="http://localhost:6060/src/net/ip.go?s=11293:11324#L472">String</a></h3>
<pre>func (n *<a href="index.html#IPNet">IPNet</a>) String() <a href="../builtin/index.html#string">string</a></pre>
<p>
String returns the CIDR notation of n like &#34;192.168.100.1/24&#34;
or &#34;2001:DB8::/48&#34; as defined in RFC 4632 and RFC 4291.
If the mask is not in the canonical form, it returns the
string which consists of an IP address, followed by a slash
character and a mask expressed as hexadecimal form with no
punctuation like &#34;192.168.100.1/c000ff00&#34;.
</p>
<h2 id="Interface">type <a href="http://localhost:6060/src/net/interface.go?s=718:1084#L10">Interface</a></h2>
<pre>type Interface struct {
Index <a href="../builtin/index.html#int">int</a> <span class="comment">// positive integer that starts at one, zero is never used</span>
MTU <a href="../builtin/index.html#int">int</a> <span class="comment">// maximum transmission unit</span>
Name <a href="../builtin/index.html#string">string</a> <span class="comment">// e.g., &#34;en0&#34;, &#34;lo0&#34;, &#34;eth0.100&#34;</span>
HardwareAddr <a href="index.html#HardwareAddr">HardwareAddr</a> <span class="comment">// IEEE MAC-48, EUI-48 and EUI-64 form</span>
Flags <a href="index.html#Flags">Flags</a> <span class="comment">// e.g., FlagUp, FlagLoopback, FlagMulticast</span>
}</pre>
<p>
Interface represents a mapping between network interface name
and index. It also represents network interface facility
information.
</p>
<h3 id="InterfaceByIndex">func <a href="http://localhost:6060/src/net/interface.go?s=3208:3260#L97">InterfaceByIndex</a></h3>
<pre>func InterfaceByIndex(index <a href="../builtin/index.html#int">int</a>) (*<a href="index.html#Interface">Interface</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
InterfaceByIndex returns the interface specified by index.
</p>
<h3 id="InterfaceByName">func <a href="http://localhost:6060/src/net/interface.go?s=3937:3990#L122">InterfaceByName</a></h3>
<pre>func InterfaceByName(name <a href="../builtin/index.html#string">string</a>) (*<a href="index.html#Interface">Interface</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
InterfaceByName returns the interface specified by name.
</p>
<h3 id="Interface.Addrs">func (*Interface) <a href="http://localhost:6060/src/net/interface.go?s=1850:1895#L53">Addrs</a></h3>
<pre>func (ifi *<a href="index.html#Interface">Interface</a>) Addrs() ([]<a href="index.html#Addr">Addr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Addrs returns interface addresses for a specific interface.
</p>
<h3 id="Interface.MulticastAddrs">func (*Interface) <a href="http://localhost:6060/src/net/interface.go?s=2266:2320#L66">MulticastAddrs</a></h3>
<pre>func (ifi *<a href="index.html#Interface">Interface</a>) MulticastAddrs() ([]<a href="index.html#Addr">Addr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
MulticastAddrs returns multicast, joined group addresses for
a specific interface.
</p>
<h2 id="InvalidAddrError">type <a href="http://localhost:6060/src/net/net.go?s=15306:15334#L499">InvalidAddrError</a></h2>
<pre>type InvalidAddrError <a href="../builtin/index.html#string">string</a></pre>
<h3 id="InvalidAddrError.Error">func (InvalidAddrError) <a href="http://localhost:6060/src/net/net.go?s=15336:15376#L501">Error</a></h3>
<pre>func (e <a href="index.html#InvalidAddrError">InvalidAddrError</a>) Error() <a href="../builtin/index.html#string">string</a></pre>
<h3 id="InvalidAddrError.Temporary">func (InvalidAddrError) <a href="http://localhost:6060/src/net/net.go?s=15460:15502#L503">Temporary</a></h3>
<pre>func (e <a href="index.html#InvalidAddrError">InvalidAddrError</a>) Temporary() <a href="../builtin/index.html#bool">bool</a></pre>
<h3 id="InvalidAddrError.Timeout">func (InvalidAddrError) <a href="http://localhost:6060/src/net/net.go?s=15400:15440#L502">Timeout</a></h3>
<pre>func (e <a href="index.html#InvalidAddrError">InvalidAddrError</a>) Timeout() <a href="../builtin/index.html#bool">bool</a></pre>
<h2 id="Listener">type <a href="http://localhost:6060/src/net/net.go?s=11216:11518#L336">Listener</a></h2>
<pre>type Listener interface {
<span class="comment">// Accept waits for and returns the next connection to the listener.</span>
Accept() (<a href="index.html#Conn">Conn</a>, <a href="../builtin/index.html#error">error</a>)
<span class="comment">// Close closes the listener.</span>
<span class="comment">// Any blocked Accept operations will be unblocked and return errors.</span>
Close() <a href="../builtin/index.html#error">error</a>
<span class="comment">// Addr returns the listener&#39;s network address.</span>
Addr() <a href="index.html#Addr">Addr</a>
}</pre>
<p>
A Listener is a generic network listener for stream-oriented protocols.
</p>
<p>
Multiple goroutines may invoke methods on a Listener simultaneously.
</p>
<div id="example_Listener" class="toggle">
<div class="collapsed">
<p class="exampleHeading toggleButton"><span class="text">Example</span></p>
</div>
<div class="expanded">
<p class="exampleHeading toggleButton"><span class="text">Example</span></p>
<p>Code:</p>
<pre class="code">
<span class="comment">// Listen on TCP port 2000 on all interfaces.</span>
l, err := net.Listen(&#34;tcp&#34;, &#34;:2000&#34;)
if err != nil {
log.Fatal(err)
}
defer l.Close()
for {
<span class="comment">// Wait for a connection.</span>
conn, err := l.Accept()
if err != nil {
log.Fatal(err)
}
<span class="comment">// Handle the connection in a new goroutine.</span>
<span class="comment">// The loop then returns to accepting, so that</span>
<span class="comment">// multiple connections may be served concurrently.</span>
go func(c net.Conn) {
<span class="comment">// Echo all incoming data.</span>
io.Copy(c, c)
<span class="comment">// Shut down the connection.</span>
c.Close()
}(conn)
}
</pre>
</div>
</div>
<h3 id="FileListener">func <a href="http://localhost:6060/src/net/file.go?s=957:1011#L20">FileListener</a></h3>
<pre>func FileListener(f *<a href="../os/index.html">os</a>.<a href="../os/index.html#File">File</a>) (ln <a href="index.html#Listener">Listener</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
FileListener returns a copy of the network listener corresponding
to the open file f.
It is the caller&#39;s responsibility to close ln when finished.
Closing ln does not affect f, and closing f does not affect ln.
</p>
<h3 id="Listen">func <a href="http://localhost:6060/src/net/dial.go?s=12150:12198#L387">Listen</a></h3>
<pre>func Listen(net, laddr <a href="../builtin/index.html#string">string</a>) (<a href="index.html#Listener">Listener</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Listen announces on the local network address laddr.
The network net must be a stream-oriented network: &#34;tcp&#34;, &#34;tcp4&#34;,
&#34;tcp6&#34;, &#34;unix&#34; or &#34;unixpacket&#34;.
For TCP and UDP, the syntax of laddr is &#34;host:port&#34;, like &#34;127.0.0.1:8080&#34;.
If host is omitted, as in &#34;:8080&#34;, Listen listens on all available interfaces
instead of just the interface with the given host address.
See Dial for more details about address syntax.
</p>
<h2 id="MX">type <a href="http://localhost:6060/src/net/dnsclient.go?s=6004:6048#L231">MX</a></h2>
<pre>type MX struct {
Host <a href="../builtin/index.html#string">string</a>
Pref <a href="../builtin/index.html#uint16">uint16</a>
}</pre>
<p>
An MX represents a single DNS MX record.
</p>
<h2 id="NS">type <a href="http://localhost:6060/src/net/dnsclient.go?s=6539:6570#L253">NS</a></h2>
<pre>type NS struct {
Host <a href="../builtin/index.html#string">string</a>
}</pre>
<p>
An NS represents a single DNS NS record.
</p>
<h2 id="OpError">type <a href="http://localhost:6060/src/net/net.go?s=12298:13072#L370">OpError</a></h2>
<pre>type OpError struct {
<span class="comment">// Op is the operation which caused the error, such as</span>
<span class="comment">// &#34;read&#34; or &#34;write&#34;.</span>
Op <a href="../builtin/index.html#string">string</a>
<span class="comment">// Net is the network type on which this error occurred,</span>
<span class="comment">// such as &#34;tcp&#34; or &#34;udp6&#34;.</span>
Net <a href="../builtin/index.html#string">string</a>
<span class="comment">// For operations involving a remote network connection, like</span>
<span class="comment">// Dial, Read, or Write, Source is the corresponding local</span>
<span class="comment">// network address.</span>
Source <a href="index.html#Addr">Addr</a>
<span class="comment">// Addr is the network address for which this error occurred.</span>
<span class="comment">// For local operations, like Listen or SetDeadline, Addr is</span>
<span class="comment">// the address of the local endpoint being manipulated.</span>
<span class="comment">// For operations involving a remote network connection, like</span>
<span class="comment">// Dial, Read, or Write, Addr is the remote address of that</span>
<span class="comment">// connection.</span>
Addr <a href="index.html#Addr">Addr</a>
<span class="comment">// Err is the error that occurred during the operation.</span>
Err <a href="../builtin/index.html#error">error</a>
}</pre>
<p>
OpError is the error type usually returned by functions in the net
package. It describes the operation, network type, and address of
an error.
</p>
<h3 id="OpError.Error">func (*OpError) <a href="http://localhost:6060/src/net/net.go?s=13074:13106#L396">Error</a></h3>
<pre>func (e *<a href="index.html#OpError">OpError</a>) Error() <a href="../builtin/index.html#string">string</a></pre>
<h3 id="OpError.Temporary">func (*OpError) <a href="http://localhost:6060/src/net/net.go?s=14008:14042#L447">Temporary</a></h3>
<pre>func (e *<a href="index.html#OpError">OpError</a>) Temporary() <a href="../builtin/index.html#bool">bool</a></pre>
<h3 id="OpError.Timeout">func (*OpError) <a href="http://localhost:6060/src/net/net.go?s=13767:13799#L434">Timeout</a></h3>
<pre>func (e *<a href="index.html#OpError">OpError</a>) Timeout() <a href="../builtin/index.html#bool">bool</a></pre>
<h2 id="PacketConn">type <a href="http://localhost:6060/src/net/net.go?s=9346:11020#L288">PacketConn</a></h2>
<pre>type PacketConn interface {
<span class="comment">// ReadFrom reads a packet from the connection,</span>
<span class="comment">// copying the payload into b. It returns the number of</span>
<span class="comment">// bytes copied into b and the return address that</span>
<span class="comment">// was on the packet.</span>
<span class="comment">// ReadFrom can be made to time out and return</span>
<span class="comment">// an error with Timeout() == true after a fixed time limit;</span>
<span class="comment">// see SetDeadline and SetReadDeadline.</span>
ReadFrom(b []<a href="../builtin/index.html#byte">byte</a>) (n <a href="../builtin/index.html#int">int</a>, addr <a href="index.html#Addr">Addr</a>, err <a href="../builtin/index.html#error">error</a>)
<span class="comment">// WriteTo writes a packet with payload b to addr.</span>
<span class="comment">// WriteTo can be made to time out and return</span>
<span class="comment">// an error with Timeout() == true after a fixed time limit;</span>
<span class="comment">// see SetDeadline and SetWriteDeadline.</span>
<span class="comment">// On packet-oriented connections, write timeouts are rare.</span>
WriteTo(b []<a href="../builtin/index.html#byte">byte</a>, addr <a href="index.html#Addr">Addr</a>) (n <a href="../builtin/index.html#int">int</a>, err <a href="../builtin/index.html#error">error</a>)
<span class="comment">// Close closes the connection.</span>
<span class="comment">// Any blocked ReadFrom or WriteTo operations will be unblocked and return errors.</span>
Close() <a href="../builtin/index.html#error">error</a>
<span class="comment">// LocalAddr returns the local network address.</span>
LocalAddr() <a href="index.html#Addr">Addr</a>
<span class="comment">// SetDeadline sets the read and write deadlines associated</span>
<span class="comment">// with the connection.</span>
SetDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a>
<span class="comment">// SetReadDeadline sets the deadline for future Read calls.</span>
<span class="comment">// If the deadline is reached, Read will fail with a timeout</span>
<span class="comment">// (see type Error) instead of blocking.</span>
<span class="comment">// A zero value for t means Read will not time out.</span>
SetReadDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a>
<span class="comment">// SetWriteDeadline sets the deadline for future Write calls.</span>
<span class="comment">// If the deadline is reached, Write will fail with a timeout</span>
<span class="comment">// (see type Error) instead of blocking.</span>
<span class="comment">// A zero value for t means Write will not time out.</span>
<span class="comment">// Even if write times out, it may return n &gt; 0, indicating that</span>
<span class="comment">// some of the data was successfully written.</span>
SetWriteDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a>
}</pre>
<p>
PacketConn is a generic packet-oriented network connection.
</p>
<p>
Multiple goroutines may invoke methods on a PacketConn simultaneously.
</p>
<h3 id="FilePacketConn">func <a href="http://localhost:6060/src/net/file.go?s=1398:1455#L32">FilePacketConn</a></h3>
<pre>func FilePacketConn(f *<a href="../os/index.html">os</a>.<a href="../os/index.html#File">File</a>) (c <a href="index.html#PacketConn">PacketConn</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
FilePacketConn returns a copy of the packet network connection
corresponding to the open file f.
It is the caller&#39;s responsibility to close f when finished.
Closing c does not affect f, and closing f does not affect c.
</p>
<h3 id="ListenPacket">func <a href="http://localhost:6060/src/net/dial.go?s=13211:13267#L414">ListenPacket</a></h3>
<pre>func ListenPacket(net, laddr <a href="../builtin/index.html#string">string</a>) (<a href="index.html#PacketConn">PacketConn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ListenPacket announces on the local network address laddr.
The network net must be a packet-oriented network: &#34;udp&#34;, &#34;udp4&#34;,
&#34;udp6&#34;, &#34;ip&#34;, &#34;ip4&#34;, &#34;ip6&#34; or &#34;unixgram&#34;.
For TCP and UDP, the syntax of laddr is &#34;host:port&#34;, like &#34;127.0.0.1:8080&#34;.
If host is omitted, as in &#34;:8080&#34;, ListenPacket listens on all available interfaces
instead of just the interface with the given host address.
See Dial for the syntax of laddr.
</p>
<h2 id="ParseError">type <a href="http://localhost:6060/src/net/net.go?s=14487:14671#L463">ParseError</a></h2>
<pre>type ParseError struct {
<span class="comment">// Type is the type of string that was expected, such as</span>
<span class="comment">// &#34;IP address&#34;, &#34;CIDR address&#34;.</span>
Type <a href="../builtin/index.html#string">string</a>
<span class="comment">// Text is the malformed text string.</span>
Text <a href="../builtin/index.html#string">string</a>
}</pre>
<p>
A ParseError is the error type of literal network address parsers.
</p>
<h3 id="ParseError.Error">func (*ParseError) <a href="http://localhost:6060/src/net/net.go?s=14673:14708#L472">Error</a></h3>
<pre>func (e *<a href="index.html#ParseError">ParseError</a>) Error() <a href="../builtin/index.html#string">string</a></pre>
<h2 id="SRV">type <a href="http://localhost:6060/src/net/dnsclient.go?s=4723:4810#L177">SRV</a></h2>
<pre>type SRV struct {
Target <a href="../builtin/index.html#string">string</a>
Port <a href="../builtin/index.html#uint16">uint16</a>
Priority <a href="../builtin/index.html#uint16">uint16</a>
Weight <a href="../builtin/index.html#uint16">uint16</a>
}</pre>
<p>
An SRV represents a single DNS SRV record.
</p>
<h2 id="TCPAddr">type <a href="http://localhost:6060/src/net/tcpsock.go?s=228:314#L1">TCPAddr</a></h2>
<pre>type TCPAddr struct {
IP <a href="index.html#IP">IP</a>
Port <a href="../builtin/index.html#int">int</a>
Zone <a href="../builtin/index.html#string">string</a> <span class="comment">// IPv6 scoped addressing zone</span>
}</pre>
<p>
TCPAddr represents the address of a TCP end point.
</p>
<h3 id="ResolveTCPAddr">func <a href="http://localhost:6060/src/net/tcpsock.go?s=1193:1248#L38">ResolveTCPAddr</a></h3>
<pre>func ResolveTCPAddr(net, addr <a href="../builtin/index.html#string">string</a>) (*<a href="index.html#TCPAddr">TCPAddr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ResolveTCPAddr parses addr as a TCP address of the form &#34;host:port&#34;
or &#34;[ipv6-host%zone]:port&#34; and resolves a pair of domain name and
port name on the network net, which must be &#34;tcp&#34;, &#34;tcp4&#34; or
&#34;tcp6&#34;. A literal address or host name for IPv6 must be enclosed
in square brackets, as in &#34;[::1]:80&#34;, &#34;[ipv6-host]:http&#34; or
&#34;[ipv6-host%zone]:80&#34;.
</p>
<h3 id="TCPAddr.Network">func (*TCPAddr) <a href="http://localhost:6060/src/net/tcpsock.go?s=370:404#L5">Network</a></h3>
<pre>func (a *<a href="index.html#TCPAddr">TCPAddr</a>) Network() <a href="../builtin/index.html#string">string</a></pre>
<p>
Network returns the address&#39;s network name, &#34;tcp&#34;.
</p>
<h3 id="TCPAddr.String">func (*TCPAddr) <a href="http://localhost:6060/src/net/tcpsock.go?s=423:456#L7">String</a></h3>
<pre>func (a *<a href="index.html#TCPAddr">TCPAddr</a>) String() <a href="../builtin/index.html#string">string</a></pre>
<h2 id="TCPConn">type <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=1005:1034#L35">TCPConn</a></h2>
<pre>type TCPConn struct {
<span class="comment">// contains filtered or unexported fields</span>
}</pre>
<p>
TCPConn is an implementation of the Conn interface for TCP network
connections.
</p>
<h3 id="DialTCP">func <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=4405:4470#L148">DialTCP</a></h3>
<pre>func DialTCP(net <a href="../builtin/index.html#string">string</a>, laddr, raddr *<a href="index.html#TCPAddr">TCPAddr</a>) (*<a href="index.html#TCPConn">TCPConn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
DialTCP connects to the remote address raddr on the network net,
which must be &#34;tcp&#34;, &#34;tcp4&#34;, or &#34;tcp6&#34;. If laddr is not nil, it is
used as the local address for the connection.
</p>
<h3 id="TCPConn.Close">func (*TCPConn) <a href="http://localhost:6060/src/net/net.go?s=6330:6358#L182">Close</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) Close() <a href="../builtin/index.html#error">error</a></pre>
<p>
Close closes the connection.
</p>
<h3 id="TCPConn.CloseRead">func (*TCPConn) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=1737:1772#L62">CloseRead</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) CloseRead() <a href="../builtin/index.html#error">error</a></pre>
<p>
CloseRead shuts down the reading side of the TCP connection.
Most callers should just use Close.
</p>
<h3 id="TCPConn.CloseWrite">func (*TCPConn) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=2073:2109#L75">CloseWrite</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) CloseWrite() <a href="../builtin/index.html#error">error</a></pre>
<p>
CloseWrite shuts down the writing side of the TCP connection.
Most callers should just use Close.
</p>
<h3 id="TCPConn.File">func (*TCPConn) <a href="http://localhost:6060/src/net/net.go?s=9014:9059#L277">File</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) File() (f *<a href="../os/index.html">os</a>.<a href="../os/index.html#File">File</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
File sets the underlying os.File to blocking mode and returns a copy.
It is the caller&#39;s responsibility to close f when finished.
Closing c does not affect f, and closing f does not affect c.
</p>
<p>
The returned os.File&#39;s file descriptor is different from the connection&#39;s.
Attempting to change properties of the original using this duplicate
may or may not have the desired effect.
</p>
<h3 id="TCPConn.LocalAddr">func (*TCPConn) <a href="http://localhost:6060/src/net/net.go?s=6687:6718#L196">LocalAddr</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) LocalAddr() <a href="index.html#Addr">Addr</a></pre>
<p>
LocalAddr returns the local network address.
The Addr returned is shared by all invocations of LocalAddr, so
do not modify it.
</p>
<h3 id="TCPConn.Read">func (*TCPConn) <a href="http://localhost:6060/src/net/net.go?s=5749:5791#L158">Read</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) Read(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Read implements the Conn Read method.
</p>
<h3 id="TCPConn.ReadFrom">func (*TCPConn) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=1194:1248#L46">ReadFrom</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) ReadFrom(r <a href="../io/index.html">io</a>.<a href="../io/index.html#Reader">Reader</a>) (<a href="../builtin/index.html#int64">int64</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ReadFrom implements the io.ReaderFrom ReadFrom method.
</p>
<h3 id="TCPConn.RemoteAddr">func (*TCPConn) <a href="http://localhost:6060/src/net/net.go?s=6912:6944#L206">RemoteAddr</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) RemoteAddr() <a href="index.html#Addr">Addr</a></pre>
<p>
RemoteAddr returns the remote network address.
The Addr returned is shared by all invocations of RemoteAddr, so
do not modify it.
</p>
<h3 id="TCPConn.SetDeadline">func (*TCPConn) <a href="http://localhost:6060/src/net/net.go?s=7054:7099#L214">SetDeadline</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) SetDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetDeadline implements the Conn SetDeadline method.
</p>
<h3 id="TCPConn.SetKeepAlive">func (*TCPConn) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=3139:3191#L110">SetKeepAlive</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) SetKeepAlive(keepalive <a href="../builtin/index.html#bool">bool</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetKeepAlive sets whether the operating system should send
keepalive messages on the connection.
</p>
<h3 id="TCPConn.SetKeepAlivePeriod">func (*TCPConn) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=3455:3514#L121">SetKeepAlivePeriod</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) SetKeepAlivePeriod(d <a href="../time/index.html">time</a>.<a href="../time/index.html#Duration">Duration</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetKeepAlivePeriod sets period between keep alives.
</p>
<h3 id="TCPConn.SetLinger">func (*TCPConn) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=2794:2836#L98">SetLinger</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) SetLinger(sec <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetLinger sets the behavior of Close on a connection which still
has data waiting to be sent or to be acknowledged.
</p>
<p>
If sec &lt; 0 (the default), the operating system finishes sending the
data in the background.
</p>
<p>
If sec == 0, the operating system discards any unsent or
unacknowledged data.
</p>
<p>
If sec &gt; 0, the data is sent in the background as with sec &lt; 0. On
some operating systems after sec seconds have elapsed any remaining
unsent data may be discarded.
</p>
<h3 id="TCPConn.SetNoDelay">func (*TCPConn) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=3964:4012#L135">SetNoDelay</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) SetNoDelay(noDelay <a href="../builtin/index.html#bool">bool</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetNoDelay controls whether the operating system should delay
packet transmission in hopes of sending fewer packets (Nagle&#39;s
algorithm). The default is true (no delay), meaning that data is
sent as soon as possible after a Write.
</p>
<h3 id="TCPConn.SetReadBuffer">func (*TCPConn) <a href="http://localhost:6060/src/net/net.go?s=8018:8063#L248">SetReadBuffer</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) SetReadBuffer(bytes <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetReadBuffer sets the size of the operating system&#39;s
receive buffer associated with the connection.
</p>
<h3 id="TCPConn.SetReadDeadline">func (*TCPConn) <a href="http://localhost:6060/src/net/net.go?s=7354:7403#L225">SetReadDeadline</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) SetReadDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetReadDeadline implements the Conn SetReadDeadline method.
</p>
<h3 id="TCPConn.SetWriteBuffer">func (*TCPConn) <a href="http://localhost:6060/src/net/net.go?s=8371:8417#L260">SetWriteBuffer</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) SetWriteBuffer(bytes <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetWriteBuffer sets the size of the operating system&#39;s
transmit buffer associated with the connection.
</p>
<h3 id="TCPConn.SetWriteDeadline">func (*TCPConn) <a href="http://localhost:6060/src/net/net.go?s=7664:7714#L236">SetWriteDeadline</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) SetWriteDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetWriteDeadline implements the Conn SetWriteDeadline method.
</p>
<h3 id="TCPConn.Write">func (*TCPConn) <a href="http://localhost:6060/src/net/net.go?s=6052:6095#L170">Write</a></h3>
<pre>func (c *<a href="index.html#TCPConn">TCPConn</a>) Write(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Write implements the Conn Write method.
</p>
<h2 id="TCPListener">type <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=8063:8101#L234">TCPListener</a></h2>
<pre>type TCPListener struct {
<span class="comment">// contains filtered or unexported fields</span>
}</pre>
<p>
TCPListener is a TCP network listener. Clients should typically
use variables of type Listener instead of assuming TCP.
</p>
<h3 id="ListenTCP">func <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=10482:10546#L310">ListenTCP</a></h3>
<pre>func ListenTCP(net <a href="../builtin/index.html#string">string</a>, laddr *<a href="index.html#TCPAddr">TCPAddr</a>) (*<a href="index.html#TCPListener">TCPListener</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ListenTCP announces on the TCP address laddr and returns a TCP
listener. Net must be &#34;tcp&#34;, &#34;tcp4&#34;, or &#34;tcp6&#34;. If laddr has a
port of 0, ListenTCP will choose an available port. The caller can
use the Addr method of TCPListener to retrieve the chosen address.
</p>
<h3 id="TCPListener.Accept">func (*TCPListener) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=8592:8636#L253">Accept</a></h3>
<pre>func (l *<a href="index.html#TCPListener">TCPListener</a>) Accept() (<a href="index.html#Conn">Conn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Accept implements the Accept method in the Listener interface; it
waits for the next call and returns a generic Conn.
</p>
<h3 id="TCPListener.AcceptTCP">func (*TCPListener) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=8182:8233#L240">AcceptTCP</a></h3>
<pre>func (l *<a href="index.html#TCPListener">TCPListener</a>) AcceptTCP() (*<a href="index.html#TCPConn">TCPConn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
AcceptTCP accepts the next incoming call and returns the new
connection.
</p>
<h3 id="TCPListener.Addr">func (*TCPListener) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=9193:9226#L277">Addr</a></h3>
<pre>func (l *<a href="index.html#TCPListener">TCPListener</a>) Addr() <a href="index.html#Addr">Addr</a></pre>
<p>
Addr returns the listener&#39;s network address, a *TCPAddr.
The Addr returned is shared by all invocations of Addr, so
do not modify it.
</p>
<h3 id="TCPListener.Close">func (*TCPListener) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=8813:8848#L263">Close</a></h3>
<pre>func (l *<a href="index.html#TCPListener">TCPListener</a>) Close() <a href="../builtin/index.html#error">error</a></pre>
<p>
Close stops listening on the TCP address.
Already Accepted connections are not closed.
</p>
<h3 id="TCPListener.File">func (*TCPListener) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=10015:10067#L298">File</a></h3>
<pre>func (l *<a href="index.html#TCPListener">TCPListener</a>) File() (f *<a href="../os/index.html">os</a>.<a href="../os/index.html#File">File</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
File returns a copy of the underlying os.File, set to blocking
mode. It is the caller&#39;s responsibility to close f when finished.
Closing l does not affect f, and closing f does not affect l.
</p>
<p>
The returned os.File&#39;s file descriptor is different from the
connection&#39;s. Attempting to change properties of the original
using this duplicate may or may not have the desired effect.
</p>
<h3 id="TCPListener.SetDeadline">func (*TCPListener) <a href="http://localhost:6060/src/net/tcpsock_posix.go?s=9357:9409#L281">SetDeadline</a></h3>
<pre>func (l *<a href="index.html#TCPListener">TCPListener</a>) SetDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetDeadline sets the deadline associated with the listener.
A zero time value disables the deadline.
</p>
<h2 id="UDPAddr">type <a href="http://localhost:6060/src/net/udpsock.go?s=228:314#L1">UDPAddr</a></h2>
<pre>type UDPAddr struct {
IP <a href="index.html#IP">IP</a>
Port <a href="../builtin/index.html#int">int</a>
Zone <a href="../builtin/index.html#string">string</a> <span class="comment">// IPv6 scoped addressing zone</span>
}</pre>
<p>
UDPAddr represents the address of a UDP end point.
</p>
<h3 id="ResolveUDPAddr">func <a href="http://localhost:6060/src/net/udpsock.go?s=1193:1248#L38">ResolveUDPAddr</a></h3>
<pre>func ResolveUDPAddr(net, addr <a href="../builtin/index.html#string">string</a>) (*<a href="index.html#UDPAddr">UDPAddr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ResolveUDPAddr parses addr as a UDP address of the form &#34;host:port&#34;
or &#34;[ipv6-host%zone]:port&#34; and resolves a pair of domain name and
port name on the network net, which must be &#34;udp&#34;, &#34;udp4&#34; or
&#34;udp6&#34;. A literal address or host name for IPv6 must be enclosed
in square brackets, as in &#34;[::1]:80&#34;, &#34;[ipv6-host]:http&#34; or
&#34;[ipv6-host%zone]:80&#34;.
</p>
<h3 id="UDPAddr.Network">func (*UDPAddr) <a href="http://localhost:6060/src/net/udpsock.go?s=370:404#L5">Network</a></h3>
<pre>func (a *<a href="index.html#UDPAddr">UDPAddr</a>) Network() <a href="../builtin/index.html#string">string</a></pre>
<p>
Network returns the address&#39;s network name, &#34;udp&#34;.
</p>
<h3 id="UDPAddr.String">func (*UDPAddr) <a href="http://localhost:6060/src/net/udpsock.go?s=423:456#L7">String</a></h3>
<pre>func (a *<a href="index.html#UDPAddr">UDPAddr</a>) String() <a href="../builtin/index.html#string">string</a></pre>
<h2 id="UDPConn">type <a href="http://localhost:6060/src/net/udpsock_posix.go?s=1010:1039#L33">UDPConn</a></h2>
<pre>type UDPConn struct {
<span class="comment">// contains filtered or unexported fields</span>
}</pre>
<p>
UDPConn is the implementation of the Conn and PacketConn interfaces
for UDP network connections.
</p>
<h3 id="DialUDP">func <a href="http://localhost:6060/src/net/udpsock_posix.go?s=5713:5778#L169">DialUDP</a></h3>
<pre>func DialUDP(net <a href="../builtin/index.html#string">string</a>, laddr, raddr *<a href="index.html#UDPAddr">UDPAddr</a>) (*<a href="index.html#UDPConn">UDPConn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
DialUDP connects to the remote address raddr on the network net,
which must be &#34;udp&#34;, &#34;udp4&#34;, or &#34;udp6&#34;. If laddr is not nil, it is
used as the local address for the connection.
</p>
<h3 id="ListenMulticastUDP">func <a href="http://localhost:6060/src/net/udpsock_posix.go?s=7970:8059#L223">ListenMulticastUDP</a></h3>
<pre>func ListenMulticastUDP(network <a href="../builtin/index.html#string">string</a>, ifi *<a href="index.html#Interface">Interface</a>, gaddr *<a href="index.html#UDPAddr">UDPAddr</a>) (*<a href="index.html#UDPConn">UDPConn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ListenMulticastUDP listens for incoming multicast UDP packets
addressed to the group address gaddr on the interface ifi.
Network must be &#34;udp&#34;, &#34;udp4&#34; or &#34;udp6&#34;.
ListenMulticastUDP uses the system-assigned multicast interface
when ifi is nil, although this is not recommended because the
assignment depends on platforms and sometimes it might require
routing configuration.
</p>
<p>
ListenMulticastUDP is just for convenience of simple, small
applications. There are golang.org/x/net/ipv4 and
golang.org/x/net/ipv6 packages for general purpose uses.
</p>
<h3 id="ListenUDP">func <a href="http://localhost:6060/src/net/udpsock_posix.go?s=6888:6948#L196">ListenUDP</a></h3>
<pre>func ListenUDP(net <a href="../builtin/index.html#string">string</a>, laddr *<a href="index.html#UDPAddr">UDPAddr</a>) (*<a href="index.html#UDPConn">UDPConn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ListenUDP listens for incoming UDP packets addressed to the local
address laddr. Net must be &#34;udp&#34;, &#34;udp4&#34;, or &#34;udp6&#34;. If laddr has
a port of 0, ListenUDP will choose an available port.
The LocalAddr method of the returned UDPConn can be used to
discover the port. The returned connection&#39;s ReadFrom and WriteTo
methods can be used to receive and send UDP packets with per-packet
addressing.
</p>
<h3 id="UDPConn.Close">func (*UDPConn) <a href="http://localhost:6060/src/net/net.go?s=6330:6358#L182">Close</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) Close() <a href="../builtin/index.html#error">error</a></pre>
<p>
Close closes the connection.
</p>
<h3 id="UDPConn.File">func (*UDPConn) <a href="http://localhost:6060/src/net/net.go?s=9014:9059#L277">File</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) File() (f *<a href="../os/index.html">os</a>.<a href="../os/index.html#File">File</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
File sets the underlying os.File to blocking mode and returns a copy.
It is the caller&#39;s responsibility to close f when finished.
Closing c does not affect f, and closing f does not affect c.
</p>
<p>
The returned os.File&#39;s file descriptor is different from the connection&#39;s.
Attempting to change properties of the original using this duplicate
may or may not have the desired effect.
</p>
<h3 id="UDPConn.LocalAddr">func (*UDPConn) <a href="http://localhost:6060/src/net/net.go?s=6687:6718#L196">LocalAddr</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) LocalAddr() <a href="index.html#Addr">Addr</a></pre>
<p>
LocalAddr returns the local network address.
The Addr returned is shared by all invocations of LocalAddr, so
do not modify it.
</p>
<h3 id="UDPConn.Read">func (*UDPConn) <a href="http://localhost:6060/src/net/net.go?s=5749:5791#L158">Read</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) Read(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Read implements the Conn Read method.
</p>
<h3 id="UDPConn.ReadFrom">func (*UDPConn) <a href="http://localhost:6060/src/net/udpsock_posix.go?s=2011:2066#L65">ReadFrom</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) ReadFrom(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, <a href="index.html#Addr">Addr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ReadFrom implements the PacketConn ReadFrom method.
</p>
<h3 id="UDPConn.ReadFromUDP">func (*UDPConn) <a href="http://localhost:6060/src/net/udpsock_posix.go?s=1430:1492#L46">ReadFromUDP</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) ReadFromUDP(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, *<a href="index.html#UDPAddr">UDPAddr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ReadFromUDP reads a UDP packet from c, copying the payload into b.
It returns the number of bytes copied into b and the return address
that was on the packet.
</p>
<p>
ReadFromUDP can be made to time out and return an error with
Timeout() == true after a fixed time limit; see SetDeadline and
SetReadDeadline.
</p>
<h3 id="UDPConn.ReadMsgUDP">func (*UDPConn) <a href="http://localhost:6060/src/net/udpsock_posix.go?s=2500:2590#L81">ReadMsgUDP</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) ReadMsgUDP(b, oob []<a href="../builtin/index.html#byte">byte</a>) (n, oobn, flags <a href="../builtin/index.html#int">int</a>, addr *<a href="index.html#UDPAddr">UDPAddr</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ReadMsgUDP reads a packet from c, copying the payload into b and
the associated out-of-band data into oob. It returns the number
of bytes copied into b, the number of bytes copied into oob, the
flags that were set on the packet and the source address of the
packet.
</p>
<h3 id="UDPConn.RemoteAddr">func (*UDPConn) <a href="http://localhost:6060/src/net/net.go?s=6912:6944#L206">RemoteAddr</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) RemoteAddr() <a href="index.html#Addr">Addr</a></pre>
<p>
RemoteAddr returns the remote network address.
The Addr returned is shared by all invocations of RemoteAddr, so
do not modify it.
</p>
<h3 id="UDPConn.SetDeadline">func (*UDPConn) <a href="http://localhost:6060/src/net/net.go?s=7054:7099#L214">SetDeadline</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) SetDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetDeadline implements the Conn SetDeadline method.
</p>
<h3 id="UDPConn.SetReadBuffer">func (*UDPConn) <a href="http://localhost:6060/src/net/net.go?s=8018:8063#L248">SetReadBuffer</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) SetReadBuffer(bytes <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetReadBuffer sets the size of the operating system&#39;s
receive buffer associated with the connection.
</p>
<h3 id="UDPConn.SetReadDeadline">func (*UDPConn) <a href="http://localhost:6060/src/net/net.go?s=7354:7403#L225">SetReadDeadline</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) SetReadDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetReadDeadline implements the Conn SetReadDeadline method.
</p>
<h3 id="UDPConn.SetWriteBuffer">func (*UDPConn) <a href="http://localhost:6060/src/net/net.go?s=8371:8417#L260">SetWriteBuffer</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) SetWriteBuffer(bytes <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetWriteBuffer sets the size of the operating system&#39;s
transmit buffer associated with the connection.
</p>
<h3 id="UDPConn.SetWriteDeadline">func (*UDPConn) <a href="http://localhost:6060/src/net/net.go?s=7664:7714#L236">SetWriteDeadline</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) SetWriteDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetWriteDeadline implements the Conn SetWriteDeadline method.
</p>
<h3 id="UDPConn.Write">func (*UDPConn) <a href="http://localhost:6060/src/net/net.go?s=6052:6095#L170">Write</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) Write(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Write implements the Conn Write method.
</p>
<h3 id="UDPConn.WriteMsgUDP">func (*UDPConn) <a href="http://localhost:6060/src/net/udpsock_posix.go?s=4717:4801#L144">WriteMsgUDP</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) WriteMsgUDP(b, oob []<a href="../builtin/index.html#byte">byte</a>, addr *<a href="index.html#UDPAddr">UDPAddr</a>) (n, oobn <a href="../builtin/index.html#int">int</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
WriteMsgUDP writes a packet to addr via c if c isn&#39;t connected, or
to c&#39;s remote destination address if c is connected (in which case
addr must be nil). The payload is copied from b and the associated
out-of-band data is copied from oob. It returns the number of
payload and out-of-band bytes written.
</p>
<h3 id="UDPConn.WriteTo">func (*UDPConn) <a href="http://localhost:6060/src/net/udpsock_posix.go?s=4121:4180#L128">WriteTo</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) WriteTo(b []<a href="../builtin/index.html#byte">byte</a>, addr <a href="index.html#Addr">Addr</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
WriteTo implements the PacketConn WriteTo method.
</p>
<h3 id="UDPConn.WriteToUDP">func (*UDPConn) <a href="http://localhost:6060/src/net/udpsock_posix.go?s=3364:3430#L106">WriteToUDP</a></h3>
<pre>func (c *<a href="index.html#UDPConn">UDPConn</a>) WriteToUDP(b []<a href="../builtin/index.html#byte">byte</a>, addr *<a href="index.html#UDPAddr">UDPAddr</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
WriteToUDP writes a UDP packet to addr via c, copying the payload
from b.
</p>
<p>
WriteToUDP can be made to time out and return an error with
Timeout() == true after a fixed time limit; see SetDeadline and
SetWriteDeadline. On packet-oriented connections, write timeouts
are rare.
</p>
<h2 id="UnixAddr">type <a href="http://localhost:6060/src/net/unixsock.go?s=244:294#L1">UnixAddr</a></h2>
<pre>type UnixAddr struct {
Name <a href="../builtin/index.html#string">string</a>
Net <a href="../builtin/index.html#string">string</a>
}</pre>
<p>
UnixAddr represents the address of a Unix domain socket end point.
</p>
<h3 id="ResolveUnixAddr">func <a href="http://localhost:6060/src/net/unixsock.go?s=826:883#L30">ResolveUnixAddr</a></h3>
<pre>func ResolveUnixAddr(net, addr <a href="../builtin/index.html#string">string</a>) (*<a href="index.html#UnixAddr">UnixAddr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ResolveUnixAddr parses addr as a Unix domain socket address.
The string net gives the network name, &#34;unix&#34;, &#34;unixgram&#34; or
&#34;unixpacket&#34;.
</p>
<h3 id="UnixAddr.Network">func (*UnixAddr) <a href="http://localhost:6060/src/net/unixsock.go?s=382:417#L5">Network</a></h3>
<pre>func (a *<a href="index.html#UnixAddr">UnixAddr</a>) Network() <a href="../builtin/index.html#string">string</a></pre>
<p>
Network returns the address&#39;s network name, &#34;unix&#34;, &#34;unixgram&#34; or
&#34;unixpacket&#34;.
</p>
<h3 id="UnixAddr.String">func (*UnixAddr) <a href="http://localhost:6060/src/net/unixsock.go?s=437:471#L9">String</a></h3>
<pre>func (a *<a href="index.html#UnixAddr">UnixAddr</a>) String() <a href="../builtin/index.html#string">string</a></pre>
<h2 id="UnixConn">type <a href="http://localhost:6060/src/net/unixsock_posix.go?s=2183:2213#L89">UnixConn</a></h2>
<pre>type UnixConn struct {
<span class="comment">// contains filtered or unexported fields</span>
}</pre>
<p>
UnixConn is an implementation of the Conn interface for connections
to Unix domain sockets.
</p>
<h3 id="DialUnix">func <a href="http://localhost:6060/src/net/unixsock_posix.go?s=7284:7352#L245">DialUnix</a></h3>
<pre>func DialUnix(net <a href="../builtin/index.html#string">string</a>, laddr, raddr *<a href="index.html#UnixAddr">UnixAddr</a>) (*<a href="index.html#UnixConn">UnixConn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
DialUnix connects to the remote address raddr on the network net,
which must be &#34;unix&#34;, &#34;unixgram&#34; or &#34;unixpacket&#34;. If laddr is not
nil, it is used as the local address for the connection.
</p>
<h3 id="ListenUnixgram">func <a href="http://localhost:6060/src/net/unixsock_posix.go?s=11754:11821#L375">ListenUnixgram</a></h3>
<pre>func ListenUnixgram(net <a href="../builtin/index.html#string">string</a>, laddr *<a href="index.html#UnixAddr">UnixAddr</a>) (*<a href="index.html#UnixConn">UnixConn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ListenUnixgram listens for incoming Unix datagram packets addressed
to the local address laddr. The network net must be &#34;unixgram&#34;.
The returned connection&#39;s ReadFrom and WriteTo methods can be used
to receive and send packets with per-packet addressing.
</p>
<h3 id="UnixConn.Close">func (*UnixConn) <a href="http://localhost:6060/src/net/net.go?s=6330:6358#L182">Close</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) Close() <a href="../builtin/index.html#error">error</a></pre>
<p>
Close closes the connection.
</p>
<h3 id="UnixConn.CloseRead">func (*UnixConn) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=6505:6541#L218">CloseRead</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) CloseRead() <a href="../builtin/index.html#error">error</a></pre>
<p>
CloseRead shuts down the reading side of the Unix domain connection.
Most callers should just use Close.
</p>
<h3 id="UnixConn.CloseWrite">func (*UnixConn) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=6850:6887#L231">CloseWrite</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) CloseWrite() <a href="../builtin/index.html#error">error</a></pre>
<p>
CloseWrite shuts down the writing side of the Unix domain connection.
Most callers should just use Close.
</p>
<h3 id="UnixConn.File">func (*UnixConn) <a href="http://localhost:6060/src/net/net.go?s=9014:9059#L277">File</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) File() (f *<a href="../os/index.html">os</a>.<a href="../os/index.html#File">File</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
File sets the underlying os.File to blocking mode and returns a copy.
It is the caller&#39;s responsibility to close f when finished.
Closing c does not affect f, and closing f does not affect c.
</p>
<p>
The returned os.File&#39;s file descriptor is different from the connection&#39;s.
Attempting to change properties of the original using this duplicate
may or may not have the desired effect.
</p>
<h3 id="UnixConn.LocalAddr">func (*UnixConn) <a href="http://localhost:6060/src/net/net.go?s=6687:6718#L196">LocalAddr</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) LocalAddr() <a href="index.html#Addr">Addr</a></pre>
<p>
LocalAddr returns the local network address.
The Addr returned is shared by all invocations of LocalAddr, so
do not modify it.
</p>
<h3 id="UnixConn.Read">func (*UnixConn) <a href="http://localhost:6060/src/net/net.go?s=5749:5791#L158">Read</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) Read(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Read implements the Conn Read method.
</p>
<h3 id="UnixConn.ReadFrom">func (*UnixConn) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=3106:3162#L121">ReadFrom</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) ReadFrom(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, <a href="index.html#Addr">Addr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ReadFrom implements the PacketConn ReadFrom method.
</p>
<h3 id="UnixConn.ReadFromUnix">func (*UnixConn) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=2597:2662#L102">ReadFromUnix</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) ReadFromUnix(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, *<a href="index.html#UnixAddr">UnixAddr</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ReadFromUnix reads a packet from c, copying the payload into b. It
returns the number of bytes copied into b and the source address of
the packet.
</p>
<p>
ReadFromUnix can be made to time out and return an error with
Timeout() == true after a fixed time limit; see SetDeadline and
SetReadDeadline.
</p>
<h3 id="UnixConn.ReadMsgUnix">func (*UnixConn) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=3596:3689#L136">ReadMsgUnix</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) ReadMsgUnix(b, oob []<a href="../builtin/index.html#byte">byte</a>) (n, oobn, flags <a href="../builtin/index.html#int">int</a>, addr *<a href="index.html#UnixAddr">UnixAddr</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ReadMsgUnix reads a packet from c, copying the payload into b and
the associated out-of-band data into oob. It returns the number of
bytes copied into b, the number of bytes copied into oob, the flags
that were set on the packet, and the source address of the packet.
</p>
<h3 id="UnixConn.RemoteAddr">func (*UnixConn) <a href="http://localhost:6060/src/net/net.go?s=6912:6944#L206">RemoteAddr</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) RemoteAddr() <a href="index.html#Addr">Addr</a></pre>
<p>
RemoteAddr returns the remote network address.
The Addr returned is shared by all invocations of RemoteAddr, so
do not modify it.
</p>
<h3 id="UnixConn.SetDeadline">func (*UnixConn) <a href="http://localhost:6060/src/net/net.go?s=7054:7099#L214">SetDeadline</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) SetDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetDeadline implements the Conn SetDeadline method.
</p>
<h3 id="UnixConn.SetReadBuffer">func (*UnixConn) <a href="http://localhost:6060/src/net/net.go?s=8018:8063#L248">SetReadBuffer</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) SetReadBuffer(bytes <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetReadBuffer sets the size of the operating system&#39;s
receive buffer associated with the connection.
</p>
<h3 id="UnixConn.SetReadDeadline">func (*UnixConn) <a href="http://localhost:6060/src/net/net.go?s=7354:7403#L225">SetReadDeadline</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) SetReadDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetReadDeadline implements the Conn SetReadDeadline method.
</p>
<h3 id="UnixConn.SetWriteBuffer">func (*UnixConn) <a href="http://localhost:6060/src/net/net.go?s=8371:8417#L260">SetWriteBuffer</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) SetWriteBuffer(bytes <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetWriteBuffer sets the size of the operating system&#39;s
transmit buffer associated with the connection.
</p>
<h3 id="UnixConn.SetWriteDeadline">func (*UnixConn) <a href="http://localhost:6060/src/net/net.go?s=7664:7714#L236">SetWriteDeadline</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) SetWriteDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetWriteDeadline implements the Conn SetWriteDeadline method.
</p>
<h3 id="UnixConn.Write">func (*UnixConn) <a href="http://localhost:6060/src/net/net.go?s=6052:6095#L170">Write</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) Write(b []<a href="../builtin/index.html#byte">byte</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Write implements the Conn Write method.
</p>
<h3 id="UnixConn.WriteMsgUnix">func (*UnixConn) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=5645:5732#L195">WriteMsgUnix</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) WriteMsgUnix(b, oob []<a href="../builtin/index.html#byte">byte</a>, addr *<a href="index.html#UnixAddr">UnixAddr</a>) (n, oobn <a href="../builtin/index.html#int">int</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
WriteMsgUnix writes a packet to addr via c, copying the payload
from b and the associated out-of-band data from oob. It returns
the number of payload and out-of-band bytes written.
</p>
<h3 id="UnixConn.WriteTo">func (*UnixConn) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=5168:5234#L181">WriteTo</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) WriteTo(b []<a href="../builtin/index.html#byte">byte</a>, addr <a href="index.html#Addr">Addr</a>) (n <a href="../builtin/index.html#int">int</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
WriteTo implements the PacketConn WriteTo method.
</p>
<h3 id="UnixConn.WriteToUnix">func (*UnixConn) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=4358:4427#L159">WriteToUnix</a></h3>
<pre>func (c *<a href="index.html#UnixConn">UnixConn</a>) WriteToUnix(b []<a href="../builtin/index.html#byte">byte</a>, addr *<a href="index.html#UnixAddr">UnixAddr</a>) (<a href="../builtin/index.html#int">int</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
WriteToUnix writes a packet to addr via c, copying the payload from b.
</p>
<p>
WriteToUnix can be made to time out and return an error with
Timeout() == true after a fixed time limit; see SetDeadline and
SetWriteDeadline. On packet-oriented connections, write timeouts
are rare.
</p>
<h2 id="UnixListener">type <a href="http://localhost:6060/src/net/unixsock_posix.go?s=8053:8124#L265">UnixListener</a></h2>
<pre>type UnixListener struct {
<span class="comment">// contains filtered or unexported fields</span>
}</pre>
<p>
UnixListener is a Unix domain socket listener. Clients should
typically use variables of type Listener instead of assuming Unix
domain sockets.
</p>
<h3 id="ListenUnix">func <a href="http://localhost:6060/src/net/unixsock_posix.go?s=8263:8330#L273">ListenUnix</a></h3>
<pre>func ListenUnix(net <a href="../builtin/index.html#string">string</a>, laddr *<a href="index.html#UnixAddr">UnixAddr</a>) (*<a href="index.html#UnixListener">UnixListener</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
ListenUnix announces on the Unix domain socket laddr and returns a
Unix listener. The network net must be &#34;unix&#34; or &#34;unixpacket&#34;.
</p>
<h3 id="UnixListener.Accept">func (*UnixListener) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=9374:9425#L304">Accept</a></h3>
<pre>func (l *<a href="index.html#UnixListener">UnixListener</a>) Accept() (c <a href="index.html#Conn">Conn</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
Accept implements the Accept method in the Listener interface; it
waits for the next call and returns a generic Conn.
</p>
<h3 id="UnixListener.AcceptUnix">func (*UnixListener) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=8960:9014#L291">AcceptUnix</a></h3>
<pre>func (l *<a href="index.html#UnixListener">UnixListener</a>) AcceptUnix() (*<a href="index.html#UnixConn">UnixConn</a>, <a href="../builtin/index.html#error">error</a>)</pre>
<p>
AcceptUnix accepts the next incoming call and returns the new
connection.
</p>
<h3 id="UnixListener.Addr">func (*UnixListener) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=10469:10503#L342">Addr</a></h3>
<pre>func (l *<a href="index.html#UnixListener">UnixListener</a>) Addr() <a href="index.html#Addr">Addr</a></pre>
<p>
Addr returns the listener&#39;s network address.
The Addr returned is shared by all invocations of Addr, so
do not modify it.
</p>
<h3 id="UnixListener.Close">func (*UnixListener) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=9607:9643#L314">Close</a></h3>
<pre>func (l *<a href="index.html#UnixListener">UnixListener</a>) Close() <a href="../builtin/index.html#error">error</a></pre>
<p>
Close stops listening on the Unix address. Already accepted
connections are not closed.
</p>
<h3 id="UnixListener.File">func (*UnixListener) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=11293:11346#L363">File</a></h3>
<pre>func (l *<a href="index.html#UnixListener">UnixListener</a>) File() (f *<a href="../os/index.html">os</a>.<a href="../os/index.html#File">File</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
<p>
File returns a copy of the underlying os.File, set to blocking
mode. It is the caller&#39;s responsibility to close f when finished.
Closing l does not affect f, and closing f does not affect l.
</p>
<p>
The returned os.File&#39;s file descriptor is different from the
connection&#39;s. Attempting to change properties of the original
using this duplicate may or may not have the desired effect.
</p>
<h3 id="UnixListener.SetDeadline">func (*UnixListener) <a href="http://localhost:6060/src/net/unixsock_posix.go?s=10634:10687#L346">SetDeadline</a></h3>
<pre>func (l *<a href="index.html#UnixListener">UnixListener</a>) SetDeadline(t <a href="../time/index.html">time</a>.<a href="../time/index.html#Time">Time</a>) <a href="../builtin/index.html#error">error</a></pre>
<p>
SetDeadline sets the deadline associated with the listener.
A zero time value disables the deadline.
</p>
<h2 id="UnknownNetworkError">type <a href="http://localhost:6060/src/net/net.go?s=15058:15089#L493">UnknownNetworkError</a></h2>
<pre>type UnknownNetworkError <a href="../builtin/index.html#string">string</a></pre>
<h3 id="UnknownNetworkError.Error">func (UnknownNetworkError) <a href="http://localhost:6060/src/net/net.go?s=15091:15134#L495">Error</a></h3>
<pre>func (e <a href="index.html#UnknownNetworkError">UnknownNetworkError</a>) Error() <a href="../builtin/index.html#string">string</a></pre>
<h3 id="UnknownNetworkError.Temporary">func (UnknownNetworkError) <a href="http://localhost:6060/src/net/net.go?s=15242:15287#L497">Temporary</a></h3>
<pre>func (e <a href="index.html#UnknownNetworkError">UnknownNetworkError</a>) Temporary() <a href="../builtin/index.html#bool">bool</a></pre>
<h3 id="UnknownNetworkError.Timeout">func (UnknownNetworkError) <a href="http://localhost:6060/src/net/net.go?s=15179:15222#L496">Timeout</a></h3>
<pre>func (e <a href="index.html#UnknownNetworkError">UnknownNetworkError</a>) Timeout() <a href="../builtin/index.html#bool">bool</a></pre>
<h2 id="pkg-note-BUG">Bugs</h2>
<ul style="list-style: none; padding: 0;">
<li><a href="http://localhost:6060/src/net/iprawsock_posix.go?s=283:850#L4">&#x261e;</a> On every POSIX platform, reads from the &#34;ip4&#34; network
using the ReadFrom or ReadFromIP method might not return a complete
IPv4 packet, including its header, even if there is space
available. This can occur even in cases where Read or ReadMsgIP
could return a complete packet. For this reason, it is recommended
that you do not uses these methods if it is important to receive a
full packet.
The Go 1 compatibility guidelines make it impossible for us to
change the behavior of these methods; use Read or ReadMsgIP
instead.
</li>
<li><a href="http://localhost:6060/src/net/ipsock_posix.go?s=341:685#L7">&#x261e;</a> On DragonFly BSD and OpenBSD, listening on the
&#34;tcp&#34; and &#34;udp&#34; networks does not listen for both IPv4 and IPv6
connections. This is due to the fact that IPv4 traffic will not be
routed to an IPv6 socket - two separate sockets are required if
both address families are to be supported.
See inet6(4) for details.
</li>
</ul>
<h2 id="pkg-subdirectories">Subdirectories</h2>
<div class="pkg-dir">
<table>
<tr>
<th class="pkg-name">Name</th>
<th class="pkg-synopsis">Synopsis</th>
</tr>
<tr>
<td colspan="2"><a href="http://localhost:6060/pkg/">..</a></td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 0px;">
<a href="http/index.html">http</a>
</td>
<td class="pkg-synopsis">
Package http provides HTTP client and server implementations.
</td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 20px;">
<a href="http/cgi/index.html">cgi</a>
</td>
<td class="pkg-synopsis">
Package cgi implements CGI (Common Gateway Interface) as specified in RFC 3875.
</td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 20px;">
<a href="http/cookiejar/index.html">cookiejar</a>
</td>
<td class="pkg-synopsis">
Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
</td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 20px;">
<a href="http/fcgi/index.html">fcgi</a>
</td>
<td class="pkg-synopsis">
Package fcgi implements the FastCGI protocol.
</td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 20px;">
<a href="http/httptest/index.html">httptest</a>
</td>
<td class="pkg-synopsis">
Package httptest provides utilities for HTTP testing.
</td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 20px;">
<a href="http/httputil/index.html">httputil</a>
</td>
<td class="pkg-synopsis">
Package httputil provides HTTP utility functions, complementing the more common ones in the net/http package.
</td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 20px;">
<a href="http/pprof/index.html">pprof</a>
</td>
<td class="pkg-synopsis">
Package pprof serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.
</td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 0px;">
<a href="mail/index.html">mail</a>
</td>
<td class="pkg-synopsis">
Package mail implements parsing of mail messages.
</td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 0px;">
<a href="rpc/index.html">rpc</a>
</td>
<td class="pkg-synopsis">
Package rpc provides access to the exported methods of an object across a network or other I/O connection.
</td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 20px;">
<a href="rpc/jsonrpc/index.html">jsonrpc</a>
</td>
<td class="pkg-synopsis">
Package jsonrpc implements a JSON-RPC ClientCodec and ServerCodec for the rpc package.
</td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 0px;">
<a href="smtp/index.html">smtp</a>
</td>
<td class="pkg-synopsis">
Package smtp implements the Simple Mail Transfer Protocol as defined in RFC 5321.
</td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 0px;">
<a href="textproto/index.html">textproto</a>
</td>
<td class="pkg-synopsis">
Package textproto implements generic support for text-based request/response protocols in the style of HTTP, NNTP, and SMTP.
</td>
</tr>
<tr>
<td class="pkg-name" style="padding-left: 0px;">
<a href="url/index.html">url</a>
</td>
<td class="pkg-synopsis">
Package url parses URLs and implements query escaping.
</td>
</tr>
</table>
</div>
<div id="footer">
Build version go1.6.<br>
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
the content of this page is licensed under the
Creative Commons Attribution 3.0 License,
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br>
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> |
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
</div>
</div><!-- .container -->
</div><!-- #page -->
<!-- TODO(adonovan): load these from <head> using "defer" attribute? -->
<script type="text/javascript" src="../../lib/godoc/jquery.js"></script>
<script type="text/javascript" src="../../lib/godoc/jquery.treeview.js"></script>
<script type="text/javascript" src="../../lib/godoc/jquery.treeview.edit.js"></script>
<script type="text/javascript" src="../../lib/godoc/godocs.js"></script>
</body>
</html>