Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(756)

Delta Between Two Patch Sets: src/pkg/net/iprawsock.go

Issue 4244055: code review 4244055: net: drop laddr from Dial, cname from LookupHost; new f... (Closed)
Left Patch Set: diff -r 5ccb9b6f8cd1 https://go.googlecode.com/hg Created 13 years ago
Right Patch Set: diff -r 8b9c0b903333 https://go.googlecode.com/hg/ Created 13 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/net/ip_test.go ('k') | src/pkg/net/ipsock.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 // (Raw) IP sockets 5 // (Raw) IP sockets
6 6
7 package net 7 package net
8 8
9 import ( 9 import (
10 "os" 10 "os"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if !ok { 230 if !ok {
231 return 0, &OpError{"writeto", "ip", addr, os.EINVAL} 231 return 0, &OpError{"writeto", "ip", addr, os.EINVAL}
232 } 232 }
233 return c.WriteToIP(b, a) 233 return c.WriteToIP(b, a)
234 } 234 }
235 235
236 // Convert "host" into IP address. 236 // Convert "host" into IP address.
237 func hostToIP(host string) (ip IP, err os.Error) { 237 func hostToIP(host string) (ip IP, err os.Error) {
238 var addr IP 238 var addr IP
239 // Try as an IP address. 239 // Try as an IP address.
240 » addr = parseIP(host) 240 » addr = ParseIP(host)
241 if addr == nil { 241 if addr == nil {
242 // Not an IP address. Try as a DNS name. 242 // Not an IP address. Try as a DNS name.
243 addrs, err1 := LookupHost(host) 243 addrs, err1 := LookupHost(host)
244 if err1 != nil { 244 if err1 != nil {
245 err = err1 245 err = err1
246 goto Error 246 goto Error
247 } 247 }
248 addr = firstSupportedAddr(addrs) 248 addr = firstSupportedAddr(addrs)
249 if addr == nil { 249 if addr == nil {
250 // should not happen 250 // should not happen
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 349
350 // BindToDevice binds an IPConn to a network interface. 350 // BindToDevice binds an IPConn to a network interface.
351 func (c *IPConn) BindToDevice(device string) os.Error { 351 func (c *IPConn) BindToDevice(device string) os.Error {
352 if !c.ok() { 352 if !c.ok() {
353 return os.EINVAL 353 return os.EINVAL
354 } 354 }
355 c.fd.incref() 355 c.fd.incref()
356 defer c.fd.decref() 356 defer c.fd.decref()
357 return os.NewSyscallError("setsockopt", syscall.BindToDevice(c.fd.sysfd, device)) 357 return os.NewSyscallError("setsockopt", syscall.BindToDevice(c.fd.sysfd, device))
358 } 358 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b