14
// IPConn is the implementation of the Conn and PacketConn
15
// interfaces for IP network connections.
18
// SetDeadline implements the Conn SetDeadline method.
19
func (c *IPConn) SetDeadline(t time.Time) error {
23
// SetReadDeadline implements the Conn SetReadDeadline method.
24
func (c *IPConn) SetReadDeadline(t time.Time) error {
28
// SetWriteDeadline implements the Conn SetWriteDeadline method.
29
func (c *IPConn) SetWriteDeadline(t time.Time) error {
33
// Implementation of the Conn interface - see Conn for documentation.
35
// Read implements the Conn Read method.
36
func (c *IPConn) Read(b []byte) (int, error) {
37
return 0, syscall.EPLAN9
40
// Write implements the Conn Write method.
41
func (c *IPConn) Write(b []byte) (int, error) {
42
return 0, syscall.EPLAN9
45
// Close closes the IP connection.
46
func (c *IPConn) Close() error {
50
// LocalAddr returns the local network address.
51
func (c *IPConn) LocalAddr() Addr {
55
// RemoteAddr returns the remote network address, a *IPAddr.
56
func (c *IPConn) RemoteAddr() Addr {
60
// IP-specific methods.
62
// ReadFromIP reads a IP packet from c, copying the payload into b.
12
// IPConn is the implementation of the Conn and PacketConn interfaces
13
// for IP network connections.
18
// ReadFromIP reads an IP packet from c, copying the payload into b.
63
19
// It returns the number of bytes copied into b and the return address
64
20
// that was on the packet.
75
31
return 0, nil, syscall.EPLAN9
78
// WriteToIP writes a IP packet to addr via c, copying the payload from b.
34
// ReadMsgIP reads a packet from c, copying the payload into b and the
35
// associated out-of-band data into oob. It returns the number of
36
// bytes copied into b, the number of bytes copied into oob, the flags
37
// that were set on the packet and the source address of the packet.
38
func (c *IPConn) ReadMsgIP(b, oob []byte) (n, oobn, flags int, addr *IPAddr, err error) {
39
return 0, 0, 0, nil, syscall.EPLAN9
42
// WriteToIP writes an IP packet to addr via c, copying the payload
80
// WriteToIP can be made to time out and return
81
// an error with Timeout() == true after a fixed time limit;
82
// see SetDeadline and SetWriteDeadline.
83
// On packet-oriented connections, write timeouts are rare.
45
// WriteToIP can be made to time out and return an error with
46
// Timeout() == true after a fixed time limit; see SetDeadline and
47
// SetWriteDeadline. On packet-oriented connections, write timeouts
84
49
func (c *IPConn) WriteToIP(b []byte, addr *IPAddr) (int, error) {
85
50
return 0, syscall.EPLAN9
90
55
return 0, syscall.EPLAN9
93
// DialIP connects to the remote address raddr on the network protocol netProto,
94
// which must be "ip", "ip4", or "ip6" followed by a colon and a protocol number or name.
58
// WriteMsgIP writes a packet to addr via c, copying the payload from
59
// b and the associated out-of-band data from oob. It returns the
60
// number of payload and out-of-band bytes written.
61
func (c *IPConn) WriteMsgIP(b, oob []byte, addr *IPAddr) (n, oobn int, err error) {
62
return 0, 0, syscall.EPLAN9
65
// DialIP connects to the remote address raddr on the network protocol
66
// netProto, which must be "ip", "ip4", or "ip6" followed by a colon
67
// and a protocol number or name.
95
68
func DialIP(netProto string, laddr, raddr *IPAddr) (*IPConn, error) {
69
return dialIP(netProto, laddr, raddr, noDeadline)
72
func dialIP(netProto string, laddr, raddr *IPAddr, deadline time.Time) (*IPConn, error) {
96
73
return nil, syscall.EPLAN9
99
// ListenIP listens for incoming IP packets addressed to the
100
// local address laddr. The returned connection c's ReadFrom
101
// and WriteTo methods can be used to receive and send IP
102
// packets with per-packet addressing.
76
// ListenIP listens for incoming IP packets addressed to the local
77
// address laddr. The returned connection's ReadFrom and WriteTo
78
// methods can be used to receive and send IP packets with per-packet
103
80
func ListenIP(netProto string, laddr *IPAddr) (*IPConn, error) {
104
81
return nil, syscall.EPLAN9