LEFT | RIGHT |
1 // Copyright 2010 The Go Authors. All rights reserved. | 1 // Copyright 2010 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 //build darwin freebsd linux openbsd windows | 5 // +build darwin freebsd linux openbsd windows |
6 | 6 |
7 // (Raw) IP sockets | 7 // (Raw) IP sockets |
8 | 8 |
9 package net | 9 package net |
10 | 10 |
11 import ( | 11 import ( |
12 "os" | 12 "os" |
13 "sync" | 13 "sync" |
14 "syscall" | 14 "syscall" |
15 ) | 15 ) |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 // BindToDevice binds an IPConn to a network interface. | 299 // BindToDevice binds an IPConn to a network interface. |
300 func (c *IPConn) BindToDevice(device string) os.Error { | 300 func (c *IPConn) BindToDevice(device string) os.Error { |
301 if !c.ok() { | 301 if !c.ok() { |
302 return os.EINVAL | 302 return os.EINVAL |
303 } | 303 } |
304 c.fd.incref() | 304 c.fd.incref() |
305 defer c.fd.decref() | 305 defer c.fd.decref() |
306 return os.NewSyscallError("setsockopt", syscall.BindToDevice(c.fd.sysfd,
device)) | 306 return os.NewSyscallError("setsockopt", syscall.BindToDevice(c.fd.sysfd,
device)) |
307 } | 307 } |
LEFT | RIGHT |